]> git.ipfire.org Git - thirdparty/haproxy.git/commit
DEBUG/MEDIUM: memory: add optional control pool memory operations
authorWilly Tarreau <w@1wt.eu>
Wed, 28 Oct 2015 14:23:51 +0000 (15:23 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 28 Oct 2015 14:28:05 +0000 (15:28 +0100)
commitde30a684cab39db61de1101506b8676479dcd85a
tree3c2f9593b705373e3ba8ca2e52ebf859599ac233
parentac421118db064273a71d5f94929c984a96425a54
DEBUG/MEDIUM: memory: add optional control pool memory operations

When DEBUG_MEMORY_POOLS is used, we now use the link pointer at the end
of the pool to store a pointer to the pool, and to control it during
pool_free2() in order to serve four purposes :
  - at any instant we can know what pool an object was allocated from
    when examining memory, hence how we should possibly decode it ;

  - it serves to detect double free when they happen, as the pointer
    cannot be valid after the element is linked into the pool ;

  - it serves to detect if an element is released in the wrong pool ;

  - it serves as a canary, to detect if some buffers experienced an
    overflow before being release.

All these elements will definitely help better troubleshoot strange
situations, or at least confirm that certain conditions did not happen.
include/common/memory.h
src/memory.c