~/talk

How to Write a Heap Memory Profiler

Talkat CppCon 2019 · 2019-09-15..09-20· [c-and-cpp]
links:none on file
slides:none on file

Shows how to build a Linux proof‑of‑concept heap profiler that injects code with LD_PRELOAD and GOT patching, looks up original allocators via dlsym/DL_NEXT, captures call stacks with libunwind, and resolves symbols and inlined frames with elfutils/DWFL (plus a clang .debug_aranges runtime fix). Demonstrates runtime attach by calling dlopen inside the target via GDB, records millions of backtraces (example: ~7M allocations, ~2× slowdown, ~2 MB output for an editor workload), and publishes working source on GitHub.

AI-written summary · about

  1. 0:00Introduction to heap profiling
  2. 11:21LD_PRELOAD injection technique
  3. 20:31Back-trace unwinding challenges
  4. 26:57Symbol resolution deep dive
  5. 35:22Post-processing and performance
  6. 46:37Handling compiler differences
  7. 48:50Runtime attaching with GDB
  8. 57:14Building a production profiler
  9. 1:00:11Q&A session
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.