]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Disable the internal memory allocator by default
authorOndřej Surý <ondrej@sury.org>
Tue, 14 Dec 2021 09:44:04 +0000 (10:44 +0100)
committerOndřej Surý <ondrej@sury.org>
Wed, 15 Dec 2021 12:29:19 +0000 (13:29 +0100)
For small sized allocations, the internal allocator gets the memory in
bigger blobs that gets splits into right-sized chunks.  This increases
speed of small allocations and reduced the fragmentation, but such
memory is never released back to the operating system.

Disable the internal allocator by default, and add new `-M internal`
command line option to `named`.

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

index f62f82c20a8e6c107c6091bb264950f2f92a4f9f..442fc3a2bf76e57e50c3b881b660daccbc8bc78c 100644 (file)
@@ -456,6 +456,7 @@ static struct flag_def {
                        { "mctx", ISC_MEM_DEBUGCTX, false },
                        { NULL, 0, false } },
   mem_context_flags[] = { { "external", ISC_MEMFLAG_INTERNAL, true },
+                         { "internal", ISC_MEMFLAG_INTERNAL, false },
                          { "fill", ISC_MEMFLAG_FILL, false },
                          { "nofill", ISC_MEMFLAG_FILL, true },
                          { NULL, 0, false } };
index 0248b03f135fc706ac0932de1d71739b4a18bf70..2669193b07bbc0f242c5bdf9e73f81cd14d3ad14 100644 (file)
@@ -117,7 +117,7 @@ LIBISC_EXTERNAL_DATA extern unsigned int isc_mem_defaultflags;
  */
 
 #if !defined(ISC_MEM_USE_INTERNAL_MALLOC) && !__SANITIZE_ADDRESS__
-#define ISC_MEM_USE_INTERNAL_MALLOC 1
+#define ISC_MEM_USE_INTERNAL_MALLOC 0
 #endif /* ifndef ISC_MEM_USE_INTERNAL_MALLOC */
 
 /*