Tuesday, April 12, 2011

"How to use FastMM 4" explained in exactly 150 words

FastMM does wonders because it catches ALL memory leaks in your program and in most cases also detects memory corruption and access on objects that have been already freed.

In the DPR file of your projects do this:

program MyProject;
FastMM4,             <--------- FastMM ALWAYS on the first line
FormMain in 'FormMain.pas' {frmMain};

Then user FastMM4Options.exe (do a Google search for it) to switch between the debug mode and the release mode. You can do it also manually/without FastMM4Options but it takes more time. FastMM4Options is better. Even better, you can generate two configurations files (one for debug and one for release) with FastMM4Options and use a BAT script to instantly switch between them.
When you are Debug mode, your compiled Delphi program will need access to FastMM_FullDebugMode.dll which is delivered with FastMM.

To use it, just switch to debug mode, build and run your program. When you close it, FastMM will generate a report where it lists all memory leaks (if any) and the trace back to them. In Project's Options you need to have Stack Frames activated and Map File set on 'Details'.

NOTE: Use FASTMM only with Delphi 7! The newer versions of Delphi have integrated FastMM already.

Related article: How difficult is to write a solid software protection (licensing) scheme?


No comments:

Post a Comment