kevin lyda wrote:
> i had a question here but i seem to have answered it, so i thought i'd
> share...
>> memory leaks are really annoying. and they're also tough to spot.
> glibc provides a method to spot them:
>> #include <mcheck.h>
>> and then call mtrace() at the start of main(). compile the program with
> -g for debugging, and set the environment variable MALLOC_TRACE to a
> file to log memory allocation and freeing. once you've run the program
> run this:
>> mtrace <program> $MALLOC_TRACE
>> voila, it lists all the memory leaks and the lines where the memory was
> allocated.
>> dunno if this works from c++, but then c++ programs are supposed to leak
> like a sieve anyway so does it really matter?
>
By using C++ properly you can virtually eliminiate memory leaks, we do it
here in Orbiscom, and in 8 months we've only had 2 memory leaks, and that
was in some real C like code (written by an ex C programmer)
>> kevin
> --
>kevin at suberic.net "we were goin' for breakfast. in canada. we
> fork()'ed on 37058400 made a deal: if she'd stop hookin', i'd stop
> meatspace place: home shootin' people. maybe we were aiming high."
> --porter, "payback"
>> --
> Irish Linux Users' Group: ilug at linux.ie>http://www.linux.ie/mailman/listinfo/ilug for (un)subscription information.
> List maintainer: listmaster at linux.ie
--
=====================================================================
John Allen, Email: john.allen at orbiscom.com
Orbiscom Ltd, Web: http://www.orbiscom.com
3 Sandyford Park, Phone: +353-1-2945111
Sandyford Industrial Estate, Mobile: +353-86-2315986
Dublin 18. Fax: +353-1-2945119
=====================================================================
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!