I need to activate the functionality ReportMemoryLeaksOnShutdown
to report memory leaks for my application, but I want to do it only in debug mode , how can I do it?
project MiProyecto;
uses FastMM;
begin
ReportMemoryLeaksOnShutdown := True;
....
end;
Applications built using the debug build configuration in Delphi 2007 or higher are considered debug mode . In these cases, if you have left the configuration as it comes from the factory, you will have the symbol defined , so you can activate only in that case, regardless of whether the program is launched from within the IDE or not.
DEBUG
ReportMemoryLeaksOnShutdown
Adapt the code to look like this:
On the other hand, if you want to run it only if the run was launched from within the IDE and a debugger is present, you can use the variable
DebugHook
, as follows: