]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Disable memory debugging features in non-developer build
authorOndřej Surý <ondrej@sury.org>
Fri, 5 Feb 2021 09:25:07 +0000 (10:25 +0100)
committerOndřej Surý <ondrej@sury.org>
Thu, 18 Feb 2021 18:33:54 +0000 (19:33 +0100)
The two memory debugging features: ISC_MEM_DEFAULTFILL
(ISC_MEMFLAG_FILL) and ISC_MEM_TRACKLINES were always enabled in all
builds and the former was only disabled in `named`.

This commits disables those two features in non-developer build to make
the memory allocator significantly faster.

bin/named/main.c
configure.ac
lib/isc/include/isc/mem.h

index 2201ce002d1cc78690a4c7a61705698201037832..c66425e18ff5dc40ce51a271eb33b8e2afb288c0 100644 (file)
@@ -1524,15 +1524,6 @@ main(int argc, char *argv[]) {
        pk11_result_register();
 #endif /* if USE_PKCS11 */
 
-#if !ISC_MEM_DEFAULTFILL
-       /*
-        * Update the default flags to remove ISC_MEMFLAG_FILL
-        * before we parse the command line. If disabled here,
-        * it can be turned back on with -M fill.
-        */
-       isc_mem_defaultflags &= ~ISC_MEMFLAG_FILL;
-#endif /* if !ISC_MEM_DEFAULTFILL */
-
        parse_command_line(argc, argv);
 
 #ifdef ENABLE_AFL
index c8d75b2bf7bd1da946b5bc73bc0975824cff8342..1d1d1c7fa685cb6f5ffda1aef573030a98d9109a 100644 (file)
@@ -158,7 +158,7 @@ AC_ARG_ENABLE([developer],
 
 AS_IF([test "$enable_developer" = "yes"],
       [DEVELOPER_MODE=yes
-       STD_CPPFLAGS="$STD_CPPFLAGS -DISC_MEM_DEFAULTFILL=1 -DISC_LIST_CHECKINIT=1"
+       STD_CPPFLAGS="$STD_CPPFLAGS -DISC_MEM_DEFAULTFILL=1 -DISC_MEM_TRACKLINES=1 -DISC_LIST_CHECKINIT=1"
        test "${enable_fixed_rrset+set}" = set || enable_fixed_rrset=yes
        test "${enable_querytrace+set}" = set || enable_querytrace=yes
        test "${with_cmocka+set}" = set || with_cmocka=yes
index 7d63ffef23215186f4615f14e8a92ad68cd0a546..1d274316dd625aa73aeec4ca6d1330d090d387d3 100644 (file)
@@ -33,7 +33,7 @@ typedef void (*isc_mem_water_t)(void *, int);
  * allocation and freeing by file and line number.
  */
 #ifndef ISC_MEM_TRACKLINES
-#define ISC_MEM_TRACKLINES 1
+#define ISC_MEM_TRACKLINES 0
 #endif /* ifndef ISC_MEM_TRACKLINES */
 
 LIBISC_EXTERNAL_DATA extern unsigned int isc_mem_debugging;
@@ -90,10 +90,14 @@ LIBISC_EXTERNAL_DATA extern unsigned int isc_mem_defaultflags;
 #define ISC_MEMFLAG_FILL \
        0x00000004 /* fill with pattern after alloc and frees */
 
-#if !ISC_MEM_USE_INTERNAL_MALLOC
-#define ISC_MEMFLAG_DEFAULT 0
-#else /* if !ISC_MEM_USE_INTERNAL_MALLOC */
+/*%
+ * Define ISC_MEM_DEFAULTFILL=1 to turn filling the memory with pattern
+ * after alloc and free.
+ */
+#if ISC_MEM_DEFAULTFILL
 #define ISC_MEMFLAG_DEFAULT ISC_MEMFLAG_FILL
+#else /* if !ISC_MEM_USE_INTERNAL_MALLOC */
+#define ISC_MEMFLAG_DEFAULT 0
 #endif /* if !ISC_MEM_USE_INTERNAL_MALLOC */
 
 /*%