summaryrefslogtreecommitdiff
path: root/libc/stdlib/malloc/heap_free.c
diff options
context:
space:
mode:
authorMiles Bader <miles@lsi.nec.co.jp>2002-07-23 06:50:40 +0000
committerMiles Bader <miles@lsi.nec.co.jp>2002-07-23 06:50:40 +0000
commit83cef9f931bcd2030f42079c332525e1e73ab6aa (patch)
tree5867067ac5387998a301f69a59ca6d78b26680d5 /libc/stdlib/malloc/heap_free.c
parenta9752043dd652d0fb4addf947b76e57c588f430c (diff)
* Automatically try to unmap heap free-areas when they get very big.
* Instead of using mmap/munmap directly for large allocations, just use the heap for everything (this is reasonable now that heap memory can be unmapped). * Use sbrk instead of mmap/munmap on systems with an MMU.
Diffstat (limited to 'libc/stdlib/malloc/heap_free.c')
-rw-r--r--libc/stdlib/malloc/heap_free.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libc/stdlib/malloc/heap_free.c b/libc/stdlib/malloc/heap_free.c
index d8eaf7e66..ac7e00be3 100644
--- a/libc/stdlib/malloc/heap_free.c
+++ b/libc/stdlib/malloc/heap_free.c
@@ -17,7 +17,7 @@
/* Return the memory area MEM of size SIZE to HEAP. */
-void
+struct heap_free_area *
__heap_free (struct heap *heap, void *mem, size_t size)
{
struct heap_free_area *prev_fa, *fa, *new_fa;
@@ -120,8 +120,12 @@ __heap_free (struct heap *heap, void *mem, size_t size)
if (fa)
fa->prev = new_fa;
+ fa = new_fa;
+
done:
HEAP_DEBUG (heap, "after __heap_free");
__heap_unlock (heap);
+
+ return fa;
}