MEDIUM: debug: improve DEBUG_MEM_STATS to also report pool alloc/free
authorWilly Tarreau <w@1wt.eu>
Thu, 23 Jun 2022 08:54:17 +0000 (10:54 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 23 Jun 2022 09:58:01 +0000 (11:58 +0200)
commit27061cd1446d1445cd9e0b739b6459e5bde5e5d2
tree474bb353164d78f70d86d2b7a3333749572c3134
parentb8dec4a01acd18ab904c4740a9bd460134d3bf68
MEDIUM: debug: improve DEBUG_MEM_STATS to also report pool alloc/free

Sometimes using "debug dev memstats" can be frustrating because all
pool allocations are reported through pool-os.h and that's all.

But in practice there's nothing wrong with also intercepting pool_alloc,
pool_free and pool_zalloc and report their call counts and locations,
so that's what this patch does. It only uses an alternate set of macroes
for these 3 calls when DEBUG_MEM_STATS is defined. The outputs are
reported as P_ALLOC (for both pool_malloc() and pool_zalloc()) and
P_FREE (for pool_free()).
include/haproxy/bug.h
include/haproxy/pool.h
src/debug.c