mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 01:27:43 +00:00
LibC: free() should move kept empty ChunkedBlocks to the end of the list.
This ensures that we continue allocating from partially-used blocks until they are full.
This commit is contained in:
parent
658fff195c
commit
60023ff70b
1 changed files with 7 additions and 0 deletions
|
@ -204,6 +204,13 @@ void free(void* ptr)
|
||||||
#ifdef MALLOC_DEBUG
|
#ifdef MALLOC_DEBUG
|
||||||
dbgprintf("Keeping block %p around for size class %u\n", block, good_size);
|
dbgprintf("Keeping block %p around for size class %u\n", block, good_size);
|
||||||
#endif
|
#endif
|
||||||
|
if (allocator->blocks.tail() != block) {
|
||||||
|
#ifdef MALLOC_DEBUG
|
||||||
|
dbgprintf("Moving block %p to tail of list for size class %u\n", block, good_size);
|
||||||
|
#endif
|
||||||
|
allocator->blocks.remove(block);
|
||||||
|
allocator->blocks.append(block);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#ifdef MALLOC_DEBUG
|
#ifdef MALLOC_DEBUG
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue