From 83cef9f931bcd2030f42079c332525e1e73ab6aa Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Tue, 23 Jul 2002 06:50:40 +0000 Subject: * 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. --- libc/stdlib/malloc/heap_free.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'libc/stdlib/malloc/heap_free.c') 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; } -- cgit v1.2.3