Re: Finding memory leak, walking the heap?
- From: Grant Taylor <gtaylor+colda_dceji022008@xxxxxxxxxxx>
- Date: 20 Feb 2008 17:38:16 -0500
"Ed J" <jed@xxxxxxxxxxx> writes:
How can I embed checkpoints for memory leaks in my C++ code? I'm
looking for unfreed heap space allocated with "new" but not deleted,
and I would like to be able to ask for the current allocations in my
C++ code to help me pinpoint where the leak exists.
There are a smattering of diagnostic and debugging functions in the
glibc malloc library, which AFAIK is still used underneath operator
new. The numbers you want are in the "struct mallinfo" stats.
See the libc info pages for malloc:
http://www.gnu.org/software/libtool/manual/libc/Statistics-of-Malloc.html
If you want any more detail you'll probably need to implement a set of
hook functions, also as described in the manual.
--
Grant Taylor
Embedded Linux Consultant
http://www.picante.com/
.
- References:
- Finding memory leak, walking the heap?
- From: Ed J
- Finding memory leak, walking the heap?
- Prev by Date: Re: Finding memory leak, walking the heap?
- Next by Date: Re: download peak control
- Previous by thread: Re: Finding memory leak, walking the heap?
- Next by thread: Re: Finding memory leak, walking the heap?
- Index(es):