views:

1436

answers:

4

I've noticed in this post that you can get stack trace out of FastMM to show what appears to be where the object was allocated.

http://stackoverflow.com/questions/271850/how-to-track-down-tricky-memory-leak-with-fastmm

I can't find any information on how to enable this in Delphi 2009.

I have set ReportMemoryLeaksOnShutdown to true so I get the basic report, but how do I get the stack trace report?

Thanks

+12  A: 

The internal Delphi version of FastMM doesn't support stack traces.

If you want to log the memory leak stack traces, you have to:

  • download the FastMM library
  • include it as the first unit in your project:
program YourProject;
uses
  FastMM4,
  SysUtils,
  Forms,
  ...
  • enable the FullDebugMode in FastMM4Options.inc
  • set Map file to Detailed in the linking project options (the FastMM_FullDebugMode.dll processes the .map file)
  • add the FastMM_FullDebugMode.dll in your binary (or Windows System32) directory
ulrichb
FastMM_FullDebugMode.dll can also be stored in the Windows system directory.
gabr
Super. thanks very much
Jamie
+1 great instructions
Smasher
+1  A: 

You can also see this for more detailed description, than ulrichb's reply.

And don't forget to enable "Use Debug DCUs" option ;)

Alexander
+2  A: 

You may also want to check out Jeremy North's FastMM4 Option setting program. It's just a bit easier than editing the inc FastMM4Options.inc file directly. Here's the link:

FastMM4 Options Interface Blog Post

MarkF
+2  A: 

In addition, Francois Gaillard presented on CodeRage II a session called Fighting Memory Leaks for Dummies and deals specifically with FastMM. It is listed under the CodeRage II replays at thursday, November 29, 2007, 9.45am - 10:45am.

http://edn.embarcadero.com/article/37498

Regards, Erwin

Erwin