Hasty Briefsbeta

Bilingual

Poireau: A Sampling Allocation Debugger

a year ago
  • #linux
  • #memory-profiling
  • #performance
  • libpoireau library intercepts a small fraction of malloc/calloc calls to generate a heap footprint overview.
  • Plans to implement guard pages similar to Electric Fence for additional security.
  • Sampling approach minimizes performance impact, making it suitable for production use.
  • Offloads complexity to the kernel or external scripts, reducing invasiveness compared to tools like LeakSanitizer or Valgrind.
  • Reports old allocations rather than scanning for references, useful for detecting slow heap growth.
  • Targets Linux 4.8+ on 64-bit platforms with 4 KB pages.
  • Requires GCC-compatible C11 implementation and LD_PRELOAD for instrumentation.
  • Uses Linux perf for tracepoint registration and event generation.
  • Provides various signals (SIGHUP, SIGUSR1, SIGUSR2) for interacting with poireau.py to get allocation reports.
  • Performance overhead ranges from 5-20% for small/medium allocations to ~70% for large allocations.
  • Includes code derived from xoshiro 256+ 1.0 and Systemtap's sys/sdt.h, both in the public domain.