[DUG] Memcheck

Stefan Mueller muellers at orcl-toolbox.com
Thu Dec 1 14:21:17 NZDT 2005


You can do it manually (compressing the memory-creep) by calling:

if Win32Platform = VER_PLATFORM_WIN32_NT then
    SetProcessWorkingSetSize(GetCurrentProcess, $FFFFFFFF, $FFFFFFFF);

This has the same effect like a minimize/maximize.

Cheers,
Stefan





-----Original Message-----
From: delphi-bounces at ns3.123.co.nz [mailto:delphi-bounces at ns3.123.co.nz] On
Behalf Of John Bird
Sent: Thursday, December 01, 2005 10:50 AM
To: 'NZ Borland Developers Group - Delphi List'
Subject: RE: [DUG] Memcheck

Well I never!!! You are right.  The memory use drops right back after
minimise and restore. So do I blame Bill?

I am still suspicious however - I was expecting to have MemCheck tell me all
sorts of humbling things...
Surely I can’t have done it right first time around as I was learning????

I notice in the notes for Memcheck that it replaces Delphis memory manager
with its own (in order to monitor everything no doubt) so is there any
issues about leaving it in or removing it from real field or production
versions of programs - and there is also the extra compiler and linker
extras all being turned on.

John


-----Original Message-----
From: delphi-bounces at ns3.123.co.nz [mailto:delphi-bounces at ns3.123.co.nz] On
Behalf Of Sean Cross - CRM
Sent: Thursday, 1 December 2005 11:34 a.m.
To: NZ Borland Developers Group - Delphi List
Subject: RE: [DUG] Memcheck


Try minimising and restoring your app to see if that makes a difference.  It
seems to be a windows issue where the working set gradually increases as you
allocate and deallocate memory.  Doing a minimise causes windows to compact
the working set.  I believe that windows will also do this if memory
pressure gets too great.

I get the same thing where one app gradually gets up to about 40meg usage.
Minimising and restoring reduces it to  4meg.

Regards

Sean
-----------------------------
Sean Cross
Systems Development

CRM
PO Box 230
Napier
Phone:   06 835 5868
Mobile:  021 270 3466
Email:   sean.cross at crm.co.nz


 

> -----Original Message-----
> From: delphi-bounces at ns3.123.co.nz
> [mailto:delphi-bounces at ns3.123.co.nz] On Behalf Of John Bird
> Sent: Thursday, 1 December 2005 11:27 a.m.
> To: 'NZ Borland Developers Group - Delphi List'
> Subject: [DUG] Memcheck
> 
> 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
> 
> 
> _______________________________________________
> Delphi mailing list
> Delphi at ns3.123.co.nz http://ns3.123.co.nz/mailman/listinfo/delphi
> 
> 

_______________________________________________
Delphi mailing list
Delphi at ns3.123.co.nz http://ns3.123.co.nz/mailman/listinfo/delphi


_______________________________________________
Delphi mailing list
Delphi at ns3.123.co.nz
http://ns3.123.co.nz/mailman/listinfo/delphi




More information about the Delphi mailing list