Forum > Editor

Laz 3.0: setHeapTraceOutput no longer prevents leak pop-up windows


I've got 2.2.6 and 3.0 installed.
The following snippet from the .lpr file behaves differently under each:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---program MyProgram; {$mode objfpc}{$H+} uses  {$IFDEF UNIX}  cthreads,  {$ENDIF}  {$IFDEF HASAMIGA}  athreads,  {$ENDIF}  Interfaces, // this includes the LCL widgetset  Forms,  { you can add units after this };  //More units not relevant to this question here...{$R *.res} begin  {$if declared(useHeapTrace)}   globalSkipIfNoLeaks := true; // supported as of debugger version 3.2.0   setHeapTraceOutput('MemLeaks\MyProgram.trc'); // <==== This is the line in question  {$endIf}  RequireDerivedFormResource:=True;  Application.Scaled:=True;  Application.Initialize;  Application.CreateForm(TForm1, Form1);  Application.Run;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...

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.

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.


[0] Message Index

Go to full version