summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorMiles Bader <miles@lsi.nec.co.jp>2002-08-01 07:46:20 +0000
committerMiles Bader <miles@lsi.nec.co.jp>2002-08-01 07:46:20 +0000
commit5d88651fa9802414111f933a504ad335535faf71 (patch)
tree812d93e938f7875c212ef0f7b78b4d4f52a87751 /libc
parent3b836d665f469a05a64df7672065d3357dffe7d9 (diff)
(MALLOC_REALLOC_MIN_FREE_SIZE): New macro.
Enable debugging if MALLOC_DEBUGGING is defined.
Diffstat (limited to 'libc')
-rw-r--r--libc/stdlib/malloc/malloc.h10
1 files 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 <stdio.h>
#define MALLOC_DEBUG(fmt, args...) fprintf (stderr, fmt , ##args)
#else