summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorjasone <jasone@FreeBSD.org>2006-01-27 04:42:10 +0000
committerjasone <jasone@FreeBSD.org>2006-01-27 04:42:10 +0000
commit7d53fc1d66c6b5d6dc093d7ce63083abaf865e0b (patch)
treef6f5f31f341a29fae67afb0bb0d682a597a1dc1e /lib
parent94601bfc126fece3d2bc44ca5b5ab8946c66e0a5 (diff)
downloadFreeBSD-src-7d53fc1d66c6b5d6dc093d7ce63083abaf865e0b.zip
FreeBSD-src-7d53fc1d66c6b5d6dc093d7ce63083abaf865e0b.tar.gz
Add NO_MALLOC_EXTRAS, so that various extra features that can cause
performance degradation can be disabled via something like the following in /etc/malloc.conf: CFLAGS+=-DNO_MALLOC_EXTRAS Suggested by: deischen
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/stdlib/malloc.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c
index 237c36f..9851178 100644
--- a/lib/libc/stdlib/malloc.c
+++ b/lib/libc/stdlib/malloc.c
@@ -133,7 +133,16 @@
/******************************************************************************/
-#define MALLOC_DEBUG
+/*
+ * In order to disable various extra features that may have negative
+ * performance impacts, (assertions, expanded statistics, redzones), define
+ * NO_MALLOC_EXTRAS.
+ */
+/* #define NO_MALLOC_EXTRAS */
+
+#ifndef NO_MALLOC_EXTRAS
+# define MALLOC_DEBUG
+#endif
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
@@ -176,12 +185,16 @@ __FBSDID("$FreeBSD$");
* Calculate statistics that can be used to get an idea of how well caching is
* working.
*/
-#define MALLOC_STATS
+#ifndef NO_MALLOC_EXTRAS
+# define MALLOC_STATS
+#endif
/*
* Include redzones before/after every region, and check for buffer overflows.
*/
-#define MALLOC_REDZONES
+#ifndef NO_MALLOC_EXTRAS
+# define MALLOC_REDZONES
+#endif
#ifdef MALLOC_REDZONES
# define MALLOC_RED_2POW 4
# define MALLOC_RED ((size_t)(1 << MALLOC_RED_2POW))
OpenPOWER on IntegriCloud