summaryrefslogtreecommitdiff
path: root/LibC/malloc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'LibC/malloc.cpp')
-rw-r--r--LibC/malloc.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/LibC/malloc.cpp b/LibC/malloc.cpp
index b7204d0d8f..38feddd216 100644
--- a/LibC/malloc.cpp
+++ b/LibC/malloc.cpp
@@ -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