|
From: Dirk S. <val...@ds...> - 2008-05-17 20:23:10
|
On Fri, 16 May 2008, jlh wrote: >> One of our software projects has same limitations. I added an interface, >> which allows to store the input data and timestamps and also the reverse >> (loading timestamps and data back from disk). > > Interesting, but in some situations this might require quite some changes to > the application. The more I change the program, the more I'm at risk of > not triggering the memory leaks I'm hunting for. I will try and see if I can > do something in that direction. Well, that interface is for general debugging (allows reproducability of real-time data processing) and not for memory leak checking. Also it was implemented at a very early software stage. :-) > Also, I somehow managed to overlook the most obvious candidate for finding > memory leaks: mtrace. It's actually part of glibc and already was on my > system. It still slows down the program quite a bit (DUMA did as well), but > much less than valgrind, since only the memory function calls get slower, but > the rest runs at native speed. It seem to be a great tool for C, but doesn't > do well with C++. :( As another reply says: There are probably 1001 malloc replacements :-) I often use mymalloc() in my C codes, which then is either defined to be malloc or points to a replacement function with #ifdef DEBUG_MEMORY. Usually also constructors and destructors of the classes, and other allocating functions (and lots of others) have an #ifdef DEBUG'ed printf() inside and a little Perl script to test if the constructions and destructions match is written very fast. And I always have an #ifdef DEBUG_OLD, which contains all the old debug statements added for special debugging purposes (I never remove them, except they conflict with new code). Turning this on usually makes software 1-10 times slower, but sometimes is very very helpful (I once got 1GB debug data in 10 minutes :-). I really can not understand, why nowadays all prefer debuggers and forget the good old printf. Ciao -- http://www.dstoecker.eu/ (PGP key available) |