4 ms·
Have you tried valgrind for this?
by jpfr 12y ago
Have you tried valgrind for this?
- thrownaway2424 12y agoYes and my experience is that valgrind is a tremendously slow way to do one-off debugging of a suspected memory leak. The instrumentation in tcmalloc is really different as it has almost no cost (depending on the size of the system you might want to adjust the sample parameter for highly multithreaded programs) and is running at all times so you can use it to troubleshoot in production. When I've used valgrind the program was so slow it wasn't the kind of thing you could put under a live workload.
- jpfr 12y agoTrue. Valgrind slows things considerably. In the end, what to use is a matter of workflow and convenience. Good to know how tcmalloc makes debugging memleaks easier. Just for for completeness, a third option would be a tracing tool that hooks into the kernel syscalls (e.g. the lttng project). They have nearly zero performance penalty as well.