0
votes

I tried to create FireMonkey application today and added ReportMemoryLeaksOnShutdown to project file to detect memory leaks, but this is not working in FireMonkey. Can you tell me, what's the problem? Is this somekind of a bug?

My code on project file:

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


  Application.Initialize;
  Application.CreateForm(TfrmMain, frmMain);
  Application.Run;

And my code that must generate memory leak:

procedure TfrmMain.Button1Click(Sender: TObject);
var
  lStrings: TStringList;

begin
  lStrings := TStringList.Create;
  lStrings.Add('test');

  ShowMessage(lStrings.CommaText);
end;

I have Debug configuration active but not getting any memory leaks reported.

1
Running your code in XE2 Update 2 shows me the 'Unexpected Memory Leak' dialog. Of course after pressing the button and closing the application. Try running your code without $ifdef debugArjen van der Spek
There's no difference if I run without DEBUG condition. Maybe Update2 fixes that problem, because I'm on Update1.evilone
@evilone, I'm getting the same thing on Mac OS, and I'm running Update 2. There is no report on shutdown on the Mac. It does show when targeting 32-bit Windows.Marcus Adams
Once you get it working, you'll find that FMX leaks like a sieve, at least according to Chris Rolliston.David Heffernan
@David: ReportMemoryLeaksOnShutdown is Windows only (it's basically FastMM), while Chris Rolliston has talked about OS X leaks only.Giel

1 Answers

0
votes

Seems that Update 2 has fixed the problem.