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()).
diff --git a/src/debug.c b/src/debug.c
index 9c23d8a..308af67 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -1269,6 +1269,8 @@
case MEM_STATS_TYPE_MALLOC: type = "MALLOC"; break;
case MEM_STATS_TYPE_REALLOC: type = "REALLOC"; break;
case MEM_STATS_TYPE_STRDUP: type = "STRDUP"; break;
+ case MEM_STATS_TYPE_P_ALLOC: type = "P_ALLOC"; break;
+ case MEM_STATS_TYPE_P_FREE: type = "P_FREE"; break;
default: type = "UNSET"; break;
}