From 23a5c396ec268f6cf1958d73b56cd107c4d9ef18 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Tue, 25 Nov 2014 13:45:16 +0100 Subject: [PATCH] DEBUG: pools: apply poisonning on every allocated pool Till now, when memory poisonning was enabled, it used to be done only after a calloc(). But sometimes it's not enough to detect unexpected sharing, so let's ensure that we now poison every allocation once it's in place. Note that enabling poisonning significantly hurts performance (it can typically half the overall performance). --- include/common/memory.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/common/memory.h b/include/common/memory.h index dd2b21f4e8..e446d81b60 100644 --- a/include/common/memory.h +++ b/include/common/memory.h @@ -179,6 +179,8 @@ void *pool_destroy2(struct pool_head *pool); else { \ (pool)->free_list = *(void **)(pool)->free_list;\ (pool)->used++; \ + if (unlikely(mem_poison_byte)) \ + memset(__p, mem_poison_byte, (pool)->size); \ } \ __p; \ }) -- 2.47.3