Author Topic: Laz 3.0: setHeapTraceOutput no longer prevents leak pop-up windows  (Read 666 times)


  • Sr. Member
  • ****
  • Posts: 290
I've got 2.2.6 and 3.0 installed.
The following snippet from the .lpr file behaves differently under each:
Code: Pascal  [Select][+][-]
  1. program MyProgram;
  3. {$mode objfpc}{$H+}
  5. uses
  6.   {$IFDEF UNIX}
  7.   cthreads,
  8.   {$ENDIF}
  10.   athreads,
  11.   {$ENDIF}
  12.   Interfaces, // this includes the LCL widgetset
  13.   Forms,
  14.   { you can add units after this };
  15.   //More units not relevant to this question here...
  16. {$R *.res}
  18. begin
  19.   {$if declared(useHeapTrace)}
  20.    globalSkipIfNoLeaks := true; // supported as of debugger version 3.2.0
  21.    setHeapTraceOutput('MemLeaks\MyProgram.trc'); // <==== This is the line in question
  22.   {$endIf}
  23.   RequireDerivedFormResource:=True;
  24.   Application.Scaled:=True;
  25.   Application.Initialize;
  26.   Application.CreateForm(TForm1, Form1);
  27.   Application.Run;
  28. end.
When there's a mem leak, Laz 2.2.6 dumps the trace to MyProgram.trc and 3.0 does not. Instead leak pop-up windows show up. Is there a setting I need to toggle? I may have done so in 2.2.6 a while back and forgotten about it...


  • Hero Member
  • *****
  • Posts: 14659
  • Sensorship about opinions does not belong here.
Re: Laz 3.0: setHeapTraceOutput no longer prevents leak pop-up windows
« Reply #1 on: January 11, 2024, 06:41:56 am »
First: I need to check if the heaptrc unit has changed, which I believe is not the case, so I will check the history.
Second: are your heaptrc settings configured correctly in the IDE?
What happens if you change the order of globalSkipIfNoLeaks and setHeapTraceOutput?
Is the .trc file present? So is there any output to file too?
Third, but this would be weird, it can be a debugger issue.
Which debugger are you using? It may be that fpdebug which is also the internal debugger is the culprit. When I wrote the wiki entry a couple of years ago, the default debugger was GDB.
« Last Edit: January 11, 2024, 08:37:47 am by Thaddy »
bitrate is always calculated like this:sample rate * bitdepth * number of channels.


  • Sr. Member
  • ****
  • Posts: 290
Re: Laz 3.0: setHeapTraceOutput no longer prevents leak pop-up windows
« Reply #2 on: January 11, 2024, 10:41:35 am »
Hi Thaddy,
 Thank you for your quick response.
 I'm running laz on a windows 11 system.

After further testing, it appears that Laz 3.0 does not like relative paths in setHeapTraceOutput. The path I've set in my original post (which works just fine with laz 2.2.6) is relative to the folder where the exe lands. If I make that path absolute, it works in 3.0.

I suppose it a quick fix and perhaps it should be added to the release note of 3.0 or to the wiki.


TinyPortal © 2005-2018