From: Willy Tarreau Date: Tue, 25 Nov 2014 12:45:16 +0000 (+0100) Subject: DEBUG: pools: apply poisonning on every allocated pool X-Git-Tag: v1.6-dev1~258 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=23a5c396ec268f6cf1958d73b56cd107c4d9ef18;p=thirdparty%2Fhaproxy.git 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). --- 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; \ })