delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/10/21/18:16:02

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: intrepid_x AT hotmail DOT com (Dave T)
Newsgroups: comp.os.msdos.djgpp
Subject: Detecting Memory Leaks
Date: 21 Oct 2003 15:09:40 -0700
Organization: http://groups.google.com
Lines: 26
Message-ID: <ba677679.0310211409.78f5f0dd@posting.google.com>
NNTP-Posting-Host: 129.97.150.126
X-Trace: posting.google.com 1066774180 30784 127.0.0.1 (21 Oct 2003 22:09:40 GMT)
X-Complaints-To: groups-abuse AT google DOT com
NNTP-Posting-Date: Tue, 21 Oct 2003 22:09:40 +0000 (UTC)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hello everyone,

I'm a novice programmer, and I have built several C++ classes with
djgpp.  I'm interested in conducting detailed testing of my work, and
in particular I want to ensure there are no memory leaks.

My general strategy for this is:

1.  Check how much free heap memory there is.
2.  Create a few thousand instances of my class, play with them,
etc...
3.  Delete all the instances of my class.
4.  Check AGAIN how much free heap memory there is.

My question is:  What function do I use to check the available heap
memory?  I found a function to check available STACK memory, but I
don't believe that's what I need here.  Is this testing plan sound?

Does anybody have any general advice for avoiding memory leaks?  I
know there are utilities to do help with this, but I want to know what
steps I can take WITHOUT using 3rd party software.  Code snippets
would be wonderful.

Thanks in advance, I look forward to your response!

Dave.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019