Newsgroups : Borland : borland.public.delphi.rtl.win32 : 2005 May : Memory usage in my program climbs forever as long as it runs. Which is bad.
| Subject: | Memory usage in my program climbs forever as long as it runs. Which is bad. |
| Posted by: | "Warren Postma" (..@tekran.com) |
| Date: | Thu, 12 May 2005 09:13:07 |
I have a large Delphi7 app where something in my giant application,
containing over 100 forms, a few hundred components of which I was not
the author of most of them, which is a realtime continuous application
intended to run for days and days. It has a lot of containers/lists
(TStringList, TObjectList, TComponentList, TList, etc) and some of the
components do a lot of GetMem/FreeMem stuff.
The application has no significant memory leaks (no matter how long it
runs, the same 30,000 bytes of stuff is left hanging around). However
total heap size climbs forever and ever. All of the data tables in my
application grow to a maximum size at midnight and then either reset to
zero, or the oldest row is added after one is deleted, so, for instance,
no unbounded growth in the size of any container/table/list etc, is
anticipated.
And yet I still get boundless memory usage growth. The application saves
its state and reloads, and is somehow using a lot less memory when it
restarts (after 3 days, it's using 100 megs of heap memory, restart it
and it goes down to 8 megs of heap memory).
note that I'm not using Task Manager to tell me the current memory
usage, I am using code like this:
function MemDumpGetTotalAllocated:Cardinal;
var
hs : THeapStatus; {Win32 API RECORD type }
begin
hs := GetHeapStatus; {Win32 API function}
result := hs.TotalAllocated;
end;
I have tried MemProof, AQTime, and other stuff, and they are great at
finding LEAKS (stuff which isn't freed when you shut down), but not so
great at finding WHAT class of object, or line of code (with a call to
GetMem) is consuming the huge and growing amount of resources while the
program continues to run.
Has anyone else been stuck with a problem like this? Ideas?
Warren