[DUG] Memcheck
John Bird
johnkbird at paradise.net.nz
Thu Dec 1 11:27:17 NZDT 2005
As a relative newbie I put memcheck in my biggest program, which has about
10-12 forms. The app does the Delphi default of creating them all at the
program start, I am happy with this as it is perfectly fast enough, and
anyway I expect them to be shown and closed repeatedly - the program does
form.show and form.close as it uses the forms as they get opened and closed
repeatedly, often returning to just the main form open.
I have noticed in Task Manager and process explorer that the memory usage of
the program does gradually increase as I open and close forms repeatedly, so
I assumed, OK I am doing something wrong and should track it down. On
putting memcheck in the program (add to uses, add memchk after begin in the
DPR, tick all the compiler and linker options) I ran it, watching the memory
increase from 4MB to 6MB as I opened and closed all the forms a few times,
then looked at the log which looks like:
MemCheck version 2.73
Total leak: 0 bytes
*** MEMCHK: Blocks STILL allocated ***
*** MEMCHK: End of allocated blocks ***
*** MEMCHK: Chronological leak information ***
*** MEMCHK: End of chronological leak information ***
*** MEMCHK: Blocks written to after destruction ***
Bad blocks count: 0
*** MEMCHK: End of blocks written to after destruction ***
So which is right? If there are no leaks why does the memory used go up
gradually even as I return the original starting form??
John
-----Original Message-----
From: delphi-bounces at ns3.123.co.nz [mailto:delphi-bounces at ns3.123.co.nz] On
Behalf Of Wayne Roser
Sent: Thursday, 1 December 2005 7:13 a.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] app terminating abruptly
PLUG FOR MEMCHECK
MemCheck is wonderful. As soon as I start every new app, I make the bottom
of the main unit look
like:
initialization
memchk;
end.
As Kyley says, put
uses
Memcheck,
and the path to the folder containing memcheck source in your default
project search path. Mine looks like: C:\Program
Files\Borland\Delphi6\Imports\Memcheck
Don't (like me) forget Kyley's note:
Make sure Stack is turned on in compiler options etc, and td32 debug info to
get relevant information.
REASON FOR DETAIL
I put these little details in because I remember being a newer newbie than I
am right now and, you know, there might be a newer newbie who, like me,
watches this list and wonders if there'll be anything really simple popping
up. If you have an embarassingly simple question out there, email the list
so that I can learn from the answers too. Ooo, I feel so self-conscious
baring my soul to an email list. Betcha I'm gonna regret this. Note to self:
pull head back in.
MAIN THING ABOUT MEMCHECK
But the main thing is to get memcheck in early. Anyone else felt the pain?
Chuck it into some app that you've been developing for years, the prototype
that you've never quite got around to rewriting, <insert own example here>,
and it'll probably bring tears to your eyes. Quite a good way to get you to
start on a rewrite from my (meagre) experience.
Wayne Roser (not real name, really Dusan Slopovic, because pen name make
more anonymous)
NZ Borland Developers Group - Delphi List <delphi at ns3.123.co.nz> on
Wednesday, 30 November 2005 at 5:55 p.m. +0000 wrote:
>Not yet. I haven't had time to work out how to use it yet. So far the
>HandleMessage in the DLL routine seems to have resolved it, but if not
>then I'll try memcheck.
>
>----- Original Message -----
>From: "Kyley Harris" <kyleyharris at gmail.com>
>To: "NZ Borland Developers Group - Delphi List" <delphi at ns3.123.co.nz>
>Sent: Wednesday, November 30, 2005 3:36 PM
>Subject: Re: [DUG] app terminating abruptly
>
>
>Have you run memcheck yet?
_______________________________________________
Delphi mailing list
Delphi at ns3.123.co.nz http://ns3.123.co.nz/mailman/listinfo/delphi
More information about the Delphi
mailing list