#define POOL_DBG_NO_CACHE 0x00000020 // disable thread-local pool caches
#define POOL_DBG_CALLER 0x00000040 // trace last caller's location
#define POOL_DBG_TAG 0x00000080 // place a tag at the end of the area
+#define POOL_DBG_POISON 0x00000100 // poison memory area on pool_alloc()
/* This is the head of a thread-local cache */
arg_mode |= MODE_DIAG;
else if (*flag == 'd' && flag[1] == 'W')
arg_mode |= MODE_ZERO_WARNING;
- else if (*flag == 'd' && flag[1] == 'M')
+ else if (*flag == 'd' && flag[1] == 'M') {
mem_poison_byte = flag[2] ? strtol(flag + 2, NULL, 0) : 'P';
+ if (mem_poison_byte >= 0)
+ pool_debugging |= POOL_DBG_POISON;
+ else
+ pool_debugging &= ~POOL_DBG_POISON;
+ }
else if (*flag == 'd' && flag[1] == 'r')
global.tune.options |= GTUNE_RESOLVE_DONTFAIL;
#if defined(HA_HAVE_DUMP_LIBS)
THREAD_LOCAL size_t pool_cache_count = 0; /* #cache objects */
static struct list pools __read_mostly = LIST_HEAD_INIT(pools);
-int mem_poison_byte __read_mostly = -1;
+int mem_poison_byte __read_mostly = 'P';
uint pool_debugging __read_mostly = /* set of POOL_DBG_* flags */
#ifdef DEBUG_FAIL_ALLOC
POOL_DBG_FAIL_ALLOC |
if (likely(p)) {
if (unlikely(flags & POOL_F_MUST_ZERO))
memset(p, 0, pool->size);
- else if (unlikely(!(flags & POOL_F_NO_POISON) && mem_poison_byte >= 0))
+ else if (unlikely(!(flags & POOL_F_NO_POISON) && (pool_debugging & POOL_DBG_POISON)))
memset(p, mem_poison_byte, pool->size);
}
return p;