- Download the latest FastMM4 release; currently it is version 4.992
- Copy the precompiled FullDebugMode dll’s from the downloaded archive to the folders where Windows can find them. I recommend to do the following:
- Manually create ‘c:\Software’ folder (or name the folder as you like);
- Create ‘c:\Software\DLL’ subfolder (for 32-bit dll’s) and ‘c:\Software\DLL64’ subfolder (for 64-bit dll’s);
- Add the paths ‘c:\Software\DLL’ and ‘c:\Software\DLL64’ to the system PATH variable (open Start menu, begin typing ‘environment …’ and choose ‘Edit the system environment variables’)
- Copy ‘FastMM_FullDebugMode.dll’ to ‘c:\Software\DLL’
- Copy ‘FastMM_FullDebugMode64.dll’ to ‘c:\Software\DLL64’
- Create FastMM4 folder; let it be ‘c:\Software\FastMM4’
- Copy ‘*.pas’ files and ‘FastMM4Options.inc’ from the main folder of the downloaded archive to ‘c:\Software\FastMM4’; do not copy the subfolders of the archive, they are just not needed here
- Enable FullDebugMode (open ‘FastMM4Options.inc’, find {.$define FullDebugMode} entry and remove the dot, {.$define FullDebugMode} –> {$define FullDebugMode})
Now the system-wide setup is completed, and we can test apps.
Delphi 10.2 Tokyo:
- Create new console project and open ‘Project Options’ dialog;
- Select ‘All configurations’ target;
- Add ‘c:\Software\FastMM4’ to the search path and click ‘OK’.
- Add ‘FastMM4’ as the first item in the ‘uses’ clause and add a simple memory leak
program Project1; {$APPTYPE CONSOLE} {$R *.res} uses FastMM4, System.SysUtils; procedure MemLeak; var P: PByte; begin GetMem(P, 10); end; begin try MemLeak; except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; // Readln; end.
If you run the app you get FastMM4 error message
Lazarus 1.8.4:
- Unfortunately FastMM4 does not support FPC on Windows and even a simplest code example does not compile.