Seems like some bug with file access.

As a temporary solution you can specify the heaptrc output at the
run-time, rather than using environment variable.

if you're using Lazarus projects you can do it in the following way:
* remove Linking option "Use heaptrc unit (-gh)". You'll use the unit manually.
* Open your projects source (Project->Source) add 'heaptrc' to your
uses section.
* Add SetHeapTraceOutput(outputfilename) call as the first line of the
program. After your application is closed, the specified file, will be
filled with debug data.
* do NOT SET envirnoment variable. Run the application.

It's also good to delete the file, otherwise information will be
appended to the file, and leakview might double-read the leaks

program test;

{$mode objfpc}{$H+}

uses
  heaptrc, {1 heaptrc must be used}
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Interfaces, // this includes the LCL widgetset
  Forms
  { you can add units after this }, mainform, SysUtils, LResources;

{$IFDEF WINDOWS}{$R test.rc}{$ENDIF}

begin
  // this is optional file cleaning, uncomment next line to delete the file
  // if FileExists('test.txt') then DeleteFile('test.txt');
  SetHeapTraceOutput('test.txt');
  {$I test.lrs}
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.
_______________________________________________
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to