Finding memory leak, walking the heap?
- From: "Ed J" <jed@xxxxxxxxxxx>
- Date: Wed, 20 Feb 2008 14:15:25 -0800
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.
Essentially, I'm looking for the ability to do something like this:
long bytes_allocated = heap_space_used();
... run code here that shouldn't grow the heap
if (bytes_allocated != heap_space_used())
printf( "I found a leak");
I'm using GCC 3.3.3. Unfortunately, I'm stuck with that GCC version due to
our development environment.
Thanks,
Ed Jubenville
.
- Follow-Ups:
- Re: Finding memory leak, walking the heap?
- From: Nitro
- Re: Finding memory leak, walking the heap?
- From: Grant Taylor
- Re: Finding memory leak, walking the heap?
- From: Bruce Stephens
- Re: Finding memory leak, walking the heap?
- From: Måns Rullgård
- Re: Finding memory leak, walking the heap?
- Prev by Date: download peak control
- Next by Date: Re: Finding memory leak, walking the heap?
- Previous by thread: download peak control
- Next by thread: Re: Finding memory leak, walking the heap?
- Index(es):
Relevant Pages
|