Reporting memory leaks on shutdown with a console application

前端 未结 4 644
野的像风
野的像风 2021-01-11 21:56

I\'ve created a console application and set ReportMemoryLeaksOnShutdown := True.

I\'ve created a TStringList but did not free it.

When the program finishes

4条回答
  •  佛祖请我去吃肉
    2021-01-11 22:38

    This is certainly a hack, don't use in production :)

    ReportMemoryLeaksOnShutdown:= True;
    IsConsole:= False;
    TStringList.Create;
    

    However, it causes the leak message (and some other messages) to be displayed in a message box (where all text can be copied by pressing Ctrl+C).

    (Tested with Delphi 10.2, please report any side effects we wouldn't like)

提交回复
热议问题