[cfe-dev] Brainstorming: ASAN snapshots

Kim Gräsman via cfe-dev cfe-dev at lists.llvm.org
Mon Oct 10 06:45:41 PDT 2016


Hi all,

I'm debugging a memory leak in a large code base, and it's not going
very well. Let's say I have plenty of time to think about other
things.

I was wondering if it would be possible to use the sanitizer
infrastructure to generate memory usage snapshots, something like a
report mapping allocation backtrace to number of outstanding
allocations.

With something like that in place, it should be easy to catch leaks
where memory is still reachable but kept alive indefinitely. Take two
snapshots and diff -- the backtraces growing in outstanding
allocations are prime suspects. I think gperftools/tcmalloc has a mode
like this, but I haven't used it myself.

Is this at all feasible? Are patches welcome? I can't say I understand
ASAN very well, but it feels like there is basic infrastructure
already in place for this.

Thanks,
- Kim



More information about the cfe-dev mailing list