proposal: disable tcache when using malloc_check

Message ID xn36s4wmrt.fsf@greed.delorie.com
State New
Headers show
Series
  • proposal: disable tcache when using malloc_check
Related show

Commit Message

DJ Delorie Nov. 14, 2018, midnight
This is a fairly trivial change with significant side effects.  The
idea is that when one is using malloc_check (via tunables or environ)
correctness and paranoia are favored over performance.  Thus, as
tcache bypasses all the malloc_check semantics, it should be disabled
therein so that every malloc/free/etc get the full malloc_check
treatment.

Does anyone have any opinions for or against this idea?

	* malloc/hooks.c (__malloc_check_init): Disable tcache.

Comments

Florian Weimer Nov. 14, 2018, 6:54 a.m. | #1
* DJ Delorie:

> This is a fairly trivial change with significant side effects.  The

> idea is that when one is using malloc_check (via tunables or environ)

> correctness and paranoia are favored over performance.  Thus, as

> tcache bypasses all the malloc_check semantics, it should be disabled

> therein so that every malloc/free/etc get the full malloc_check

> treatment.

>

> Does anyone have any opinions for or against this idea?

>

> 	* malloc/hooks.c (__malloc_check_init): Disable tcache.


I think it's the right thing to do.

Thanks,
Florian

Patch

diff --git a/malloc/hooks.c b/malloc/hooks.c
index ae7305b036..16bca80202 100644
--- a/malloc/hooks.c
+++ b/malloc/hooks.c
@@ -61,6 +61,7 @@  __malloc_check_init (void)
   __free_hook = free_check;
   __realloc_hook = realloc_check;
   __memalign_hook = memalign_check;
+  do_set_tcache_count (0);
 }
 
 /* A simple, standard set of debugging hooks.  Overhead is `only' one