News for hackers. Stuff that matters.
Re:How tcmalloc Works by thrownaway2424 on Monday November 10, 2014 @04:14PM (#8586482)
IMHO one of the nicest things about tcmalloc isn't the performance it's the profiling. It samples your allocations and records the stack trace where an object was allocated, and records that information over the life of your process. This can be invaluable when tracking leaks or performance problems suspected to be due to excessive new and delete.

http://gperftools.googlecode.com/svn/trunk/doc/heapprofile.h...

Re:How tcmalloc Works by jpfr on Monday November 10, 2014 @06:39PM (#8587377)
Have you tried valgrind for this?
Re:How tcmalloc Works by thrownaway2424 on Monday November 10, 2014 @11:00PM (#8588225)
Yes 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.
Re:How tcmalloc Works by jpfr on Tuesday November 11, 2014 @08:22AM (#8589630)
True. 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.