From 5d88651fa9802414111f933a504ad335535faf71 Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Thu, 1 Aug 2002 07:46:20 +0000 Subject: (MALLOC_REALLOC_MIN_FREE_SIZE): New macro. Enable debugging if MALLOC_DEBUGGING is defined. --- libc/stdlib/malloc/malloc.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libc/stdlib/malloc/malloc.h b/libc/stdlib/malloc/malloc.h index 193dabd64..cc2bf35ba 100644 --- a/libc/stdlib/malloc/malloc.h +++ b/libc/stdlib/malloc/malloc.h @@ -32,6 +32,12 @@ MALLOC_MIN_SIZE, will cause us not to reserve anything. */ #define MALLOC_MIN_SIZE (2*MALLOC_PAGE_SIZE) +/* When realloc shrinks an allocation, it only does so if more than this + many bytes will be freed; it must at at least HEAP_MIN_SIZE. Larger + values increase speed (by reducing heap fragmentation) at the expense of + space. */ +#define MALLOC_REALLOC_MIN_FREE_SIZE (HEAP_MIN_SIZE + 16) + /* For systems with an MMU, use sbrk to map/unmap memory for the malloc heap, instead of mmap/munmap. This is a tradeoff -- sbrk is faster than @@ -103,8 +109,8 @@ extern malloc_mutex_t __malloc_sbrk_lock; #endif /* __UCLIBC_HAS_THREADS__ */ -/* Change this to `#if 1' to cause malloc to emit debugging info to stderr. */ -#if 0 +/* Define MALLOC_DEBUGGING to cause malloc to emit debugging info to stderr. */ +#ifdef MALLOC_DEBUGGING #include #define MALLOC_DEBUG(fmt, args...) fprintf (stderr, fmt , ##args) #else -- cgit v1.2.3