How to activate ReportMemoryLeaksOnShutdown only in debug mode?

前端 未结 3 946
深忆病人
深忆病人 2021-01-04 11:54

I need to activate the ReportMemoryLeaksOnShutdown functionality to report the memory leaks of my application, but only under debug mode (when the Delphi IDE is

3条回答
  •  有刺的猬
    2021-01-04 12:22

    If you mean "debug mode" as compiled using the Debug build configuration (D2007+), you'll have the DEBUG symbol defined, so you can activate the ReportMemoryLeaksOnShutdown even when running oustide the debugger with:

    {$IFDEF DEBUG}
      ReportMemoryLeaksOnShutdown := True;
    {$ENDIF}
    

    If you want to run only if the debugger is present, look at RRUZ answer

提交回复
热议问题