Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-02

heaptrc usage misunderstanding or memory leak in TForm

4 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Roberto Padovani

Hi list,

I added the unit Heaptrc to my program and there seem to be memory leaks that i cannot find.
Then I tried to build an "empty" application to see when I introduced the leaks, however even the following "empty" application seems to have memory leaks.
To reproduce, just create a new application, add Heaptrc to the uses clause and run.
I get 64 unfreed blocks.

Can anyone help to understand why?

Thanks,

Roberto

-------------------------------------
unit Unit1;
{$mode objfpc}{$H+}
interface

uses
Heaptrc,

  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs;
type
  TForm1 = class(TForm)
  private
    { private declarations }
  public
    { public declarations }
  end;
var
  Form1: TForm1;
implementation
initialization
  {$I UnitProvaHeaptrc.lrs}
end.

Reply by email

Vincent Snijders
to Roberto Padovani
Roberto Padovani wrote 13 lines
Hi list, I added the unit Heaptrc to my program and there seem to be memory leaks that i cannot find. Then I tried to build an "empty" application to see when I introduced the leaks, however even the following "empty" application seems to have memory leaks. To reproduce, just create a new application, add Heaptrc to the uses clause and run. I get 64 unfreed blocks. Can anyone help to understand why?

You should add the heaptrc add as first unit to the main program (or let the compiler do that by compiling with -gh).

Vincent

Reply by email

JoshyFun
to Roberto Padovani: I added the unit Heaptrc to my program and there seem to be memory leaks that i cannot…

Hello Lazarus-List,

Thursday, February 11, 2010, 3:44:16 PM, you wrote:

RP> I added the unit Heaptrc to my program and there seem to be memory RP> leaks that i cannot find.
RP> Then I tried to build an "empty" application to see when I introduced RP> the leaks, however even the following "empty" application seems to RP> have memory leaks.
RP> To reproduce, just create a new application, add Heaptrc to the uses RP> clause and run.
RP> I get 64 unfreed blocks.
RP> Can anyone help to understand why?

heaptrc must be the first unit in the .lpr file as it is more or less a memory manager.

To simplify do not add heaptrc to the uses clause, use the appropiate setting in the compiler -> linker page of your project.

If you do not show the 64 leaks it would be difficult to track them down.

Best regards, JoshyFun

Reply by email

Roberto Padovani
to JoshyFun

thanks all
I was pretty sure it was a misunderstanding of mine.

Roberto

2010/2/11 JoshyFun :

Show quoted text 34 lines
Hello Lazarus-List, Thursday, February 11, 2010, 3:44:16 PM, you wrote: RP> I added the unit Heaptrc to my program and there seem to be memory RP> leaks that i cannot find. RP> Then I tried to build an "empty" application to see when I introduced RP> the leaks, however even the following "empty" application seems to RP> have memory leaks. RP> To reproduce, just create a new application, add Heaptrc to the uses RP> clause and run. RP> I get 64 unfreed blocks. RP> Can anyone help to understand why? heaptrc must be the first unit in the .lpr file as it is more or less a memory manager. To simplify do not add heaptrc to the uses clause, use the appropiate setting in the compiler -> linker page of your project. If you do not show the 64 leaks it would be difficult to track them down. -- Best regards, ?JoshyFun -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email