Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I turn on/off FastMM memory leak reporting under Delphi XE?

How do I turn on/off FastMM memory leak reporting under Delphi XE? Under Delphi 7, I had to modify the inc file. But I hear that Delphi XE has FastMM already integrated. How do I access FastMM settings?


I got this from Delphi Help:

Full source code for the Memory Manager (FastMM) is available on SourceForge.
With the full version of FastMM, you can run the memory manager in a special "debug" mode which is useful for detecting heap corruption and memory leaks. Additional features in the full version of FastMM:
Double free objects / interfaces
File logging and reports

For more information, please see the comments in the FastMM source code(FastMM4.pas and FastMM4Options.inc).

So it looks like I still have to install FastMM manually. But do i have to include 'FastMM4' in project's USES clause?

like image 414
Server Overflow Avatar asked Dec 09 '22 08:12

Server Overflow


2 Answers

You do it by assigning to the Boolean variable System.ReportMemoryLeaksOnShutdown.

This will allow you to control the single most important setting, the reporting of memory leaks. If you want more fine grained control of the FastMM settings then include FastMM in your project just as you did in Delphi 7.

like image 177
David Heffernan Avatar answered Dec 14 '22 23:12

David Heffernan


If you download the full version of FastMM from http://sourceforge.net/projects/fastmm/

You have the option to disable a single memory leak and still keep the reports on other leaks that you do want to know about.

There's also a forum for FastMM that you might find helpful: http://sourceforge.net/projects/fastmm/forums

If you install FastMM, a uses clause for it will be automatically added to the relevant files. You can see this if you look at the .dpr file. If you remove the clause, FastMM will even add it back on recompile :-).

like image 23
Johan Avatar answered Dec 15 '22 00:12

Johan