Re: Finding memory leak, walking the heap?
- From: "Nitro" <nitro-57@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 22 Feb 2008 17:07:25 -0500 (EST)
On Wed, 20 Feb 2008 14:15:25 -0800, Ed J wrote:
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
I can also reccomend electric fence. Traps debugger when you touch it...
.
- Follow-Ups:
- Re: Finding memory leak, walking the heap?
- From: Bernhard Agthe
- Re: Finding memory leak, walking the heap?
- References:
- Finding memory leak, walking the heap?
- From: Ed J
- Finding memory leak, walking the heap?
- Prev by Date: Re: download peak control
- Next by Date: THE MOST REALISTIC JACOB AND CO AVAILABLE TODAY
- Previous by thread: Re: Finding memory leak, walking the heap?
- Next by thread: Re: Finding memory leak, walking the heap?
- Index(es):
Relevant Pages
|