3 ms·
Calling Valgrind a "memory leak detector" totally underplays its usefulness. But for some reason I've never worked out, a lot of people think this is all it doe
by nnethercote 11y ago
Calling Valgrind a "memory leak detector" totally underplays its usefulness. But for some reason I've never worked out, a lot of people think this is all it does.
The main things that Memcheck, the default Valgrind tool, do are:
1. Detect accesses to inaccessible memory.
2. Detect dangerous uses of undefined values.
3. Detect memory leaks.
Memory leaks are arguably the least interesting of these three things.
ASAN can do 1 and 3, but cannot do 2. That's why Mozilla runs both Valgrind and ASAN on Firefox test automation.
There's a tool related to ASAN called MSAN that attempts to do 2, but 2 is really hard to do with static instrumentation so MSAN doesn't get much real-world use.
- glandium 11y agoAnd then there are the valgrind tools other than memcheck: cachegrind (cache and branch-prediction profiler), callgrind (call-graph profiler), helgrind (thread error detector), massif (heap profiler), and probably more I forget.
- TazeTSchnitzel 11y agoSome projects use custom allocators which detect memory leaks, so it's even less useful there.