2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 22:45:39 +00:00

Disable memory debugging features in non-developer build

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.
This commit is contained in:
Ondřej Surý
2021-02-05 10:25:07 +01:00
parent c9fe12443f
commit f34f943b16
3 changed files with 9 additions and 14 deletions

View 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

View 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

View 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 */
/*%