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:
Andreas Kling 2019-05-02 16:35:57 +02:00
parent 658fff195c
commit 60023ff70b
Notes: sideshowbarker 2024-07-19 14:20:10 +09:00

View File

@ -204,6 +204,13 @@ void free(void* ptr)
#ifdef MALLOC_DEBUG
dbgprintf("Keeping block %p around for size class %u\n", block, good_size);
#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;
}
#ifdef MALLOC_DEBUG