Question

I am trying to use FastMM version 4.99 (according to the comment at the top of FastMM4.pas). I have followed the instructions to use full debug mode with stack tracing, and am finding leaks when I run my .exe under the IDE debugger. e.g.

FastMM Leak Report Dialog

But when I try running the executable from a command prompt, or by double-clicking in Windows Explorer, I get no leaks reported. The UnicodeString leaks might be bogus, but I know for sure that the TIniFile leaks are real. How can I make FastMM report/log leaks when not using the debugger?

UPDATE: This project also uses madExcept 3.0n: the .dpr file does have FastMM4 as the first item in its uses clause. Is anything else needed to make these two coexist?

Was it helpful?

Solution

You haven't properly configured FastMM4Options.inc. From the file distributed with version 4.97, it's around line 405:

{Set this option to require the presence of the Delphi IDE to report memory
 leaks. This option has no effect if the option "EnableMemoryLeakReporting"
 is not also set.}
{.$define RequireIDEPresenceForLeakReporting}

Make sure the . is in the last line (before the $define) and rebuild your project.

@wades discovered that there's another setting, immediately below the one I mentioned, RequireDebuggerPresenceForLeakReporting, which defaults to being on. Disable it by adding a period right after the opening brace:

{Set this option to require the program to be run inside the IDE debugger to
 report memory leaks. This option has no effect if the option
 "EnableMemoryLeakReporting" is not also set.}
{$define RequireDebuggerPresenceForLeakReporting}

(Adding to this answer by @wades' request.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top