🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #1471

Memory leaks and GetHeapStatus()

#1471
From: Mike Knoblock
Date: Thu, 09 Aug 2007 18:16
34 lines
2516 bytes
I have a very large client application that appears to have a memory 
leak under certain conditions. The symptom is that Windows Task Manager 
reports increasingly high MemoryUsage over the course of several days to 
the point where the machine becomes sluggish or the application shuts 
down.

I tried to use GetHeapStatus() to track local memory allocation along 
with my calls to NEW and DELETE, but it doesn't agree with the Task 
Manager.  Specifically, THeapStatus.TotalAllocated stays the same 
(around 36M) once it settles down but TM MemoryUsage continues to climb.

I'm assuming that anything I do programatically, such as create new 
forms, allocate blocks of memory, etc, all will be reflected in 
GetHeapStatus().  If this is not the case, I need some way to meter how 
much memory I'm consuming.

I've also noticed that Task Manager will report large Memory Usage (say 
80 M) that will drop to 1-2M when the application is minimized, but when 
I refocus, Memory Usage doesn't return to 80M - it goes to some moderate 
value in between (15M or so).  I don't know if this behavior is telling 
me that TM Memory Usage is unreliable, or if I have some coding problem 
that contributes to this.

So:

1. Is Task Manager Memory Usage reliable?
2. Is GetHeapStatus() reliable, and if so, why doesn't it agree with TM?
3. Are there other tools to analyze my application's memory usage 
dynamically? For all I know, this could be a handle leak or something in 
my forms management that is at fault.

thanks for any ideas.

Mike
Technical Details
Message-ID: <46bb5a33$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!198.186.194.247.MISMATCH!news-out.readnews.com!news-xxxfer.readnews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,b4f2e24dc905850e,start
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Thu, 09 Aug 2007 13:16:22 -0500
From: Mike Knoblock <mknoblock@gmail.com>
User-Agent: Thunderbird 1.5.0.5 (Windows/20060719)
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Memory leaks and GetHeapStatus()
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 24.30.133.64
Message-ID: <46bb5a33$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1186683443 24.30.133.64 (9 Aug 2007 11:17:23 -0700)
Lines: 34
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!198.186.194.247.MISMATCH!news-out.readnews.com!news-xxxfer.readnews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail