[DUG] FastMM
John Bird
johnkbird at paradise.net.nz
Wed Mar 3 12:08:40 NZDT 2010
I decided to try some memory leak testing on a couple of programs to be sure all is OK, and after googling figured that even though I have d2007 the best was to download FastMM4 from source forge
This is what I figured to do to run the tests - anyone can correct me if I am wrong:
1 - Add Uses FastMM in ..\Components\FastMM\FastMM4.pas as the first used unit in the .DPR file. note I just edited the .DPR file manually.
2 - in the main form create add a line
ReportMemoryLeaksOnShutdown := true; //#### FastMM diagnostics if enabled
3 - Edit the FastMM4Options.Inc file to set
get an error on startup.}
{$define FullDebugMode}
[Note the program is a lot slower with this in]
4 - Add to Project compile options Debug Dcu's, generate debug info, local symbols, reference info, use debug DCU's
Add to Project link options include TD32 debug info
I know not all of these are needed, but not being sure which I just turned them all on.
5 - I found I had to add to each project search path
...\Components\FastMM otherwise it could not find FastMM4Messages.pas or FastMM4Messages.dcu
even though that folder was in the IDE global setting Tools/Options/Delphi options/Library - Win32/Browsing Path
All that done, to my relief I got a message that the only leaks were one TFileStream, and one AnsiString
"This application has leaked memory. The small block leaks are (excluding expected leaks registered by pointer):
5 - 12 bytes: TFileStream x 1
21 - 36 bytes: AnsiString x 1
Note: Memory leak detail is logged to a text file in the same folder as this application. To disable this memory leak check, undefine "EnableMemoryLeakReporting"."
This program does open and close a lot of files with TFileStream, (note I do all my fileopens with a library routine that also saves a reference number, the open mode, and the filename, and so far they all seem to be closed properly- but I am checking to be sure).
I haven't yet figured out the culprit, anyone have any hints on how to track them down, puzzled at the Ansistring one - what does that mean, as I thought strings do not get memory leaks, being reference counted. There are certainly way more than one string in the project.
Also I got a garbaged Project file - ended up with lines like:
<DCCReference Include="..\CFastMM.Pas" />
<DCCReference Include="..\CoFastMM.Pas" />
<DCCReference Include="..\ComFastMM.Pas" />
<DCCReference Include="..\CompFastMM.Pas" />
<DCCReference Include="..\CompoFastMM.Pas" />
<DCCReference Include="..\ComponeFastMM.Pas" />
<DCCReference Include="..\ComponeneFastMM.Pas" />
<DCCReference Include="..\ComponenenFastMM.Pas" />
<DCCReference Include="..\ComponenentFastMM.Pas" />
<DCCReference Include="..\ComponenentsFastMM.Pas" />
<DCCReference Include="..\ComponenFastMM.Pas" />
<DCCReference Include="..\ComponenntsFastMM.Pas" />
<DCCReference Include="..\ComponentFastMM.Pas" />
<DCCReference Include="..\ComponentsFastMM.Pas" />
<DCCReference Include="..\Components\FaFastMM.Pas" />
<DCCReference Include="..\Components\FasFastMM.Pas" />
<DCCReference Include="..\Components\FastFastMM.Pas" />
<DCCReference Include="..\Components\FastMFastMM.Pas" />
<DCCReference Include="..\Components\FastMM.Pas" />
<DCCReference Include="..\Components\FastMMFastMM.Pas" />
<DCCReference Include="..\Components\FastMM\FastMM.Pas" />
<DCCReference Include="..\Components\FastMM\FastMM4.Pas" /> <==== this is the right one
<DCCReference Include="..\Components\FFastMM.Pas" />
<DCCReference Include="..\ComponFastMM.Pas" />
<DCCReference Include="..\FastMM.Pas" />
Anyone come across this? Is it from anything I did wrong?
John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20100303/459234fc/attachment.html
More information about the Delphi
mailing list