In this topic BrunoK said if we add Application.ProcessMessages;before
Driver.Free it prevents the memory leak.
But I want to know if this is a good solution for it and if I faced a bug.
‐‐‐ Original Message ‐‐‐
On Tuesday, September 25, 2018 10:01 PM, Okoba
wrote:
> Hi,
>
> I have a memory leak problem with TFPTimer and I think I'm missing something.
> It happens randomly and not always.
> Tested with Lazarus 1.8.4 and FPC 3.0.4 and FPC 3.1.1 on last updated version
> of Windows 10 with Debug build mode and it writes a memory leak lead to
> "Driver.Enabled := True;"
> Can anyone help me?
>
> procedure TForm1.FormCreate(Sender: TObject);
> begin
> Driver := TFPTimer.Create(Self);
> Driver.Interval := 33;
> Driver.OnTimer := @DriveOnTimer;
> Driver.Enabled := True;
> end;
>
> procedure TForm1.FormDestroy(Sender: TObject);
> begin
> Driver.Enabled := False;
> Driver.Free;
> end;
>
> procedure TForm1.DriveOnTimer(Sender: TObject);
> begin
> Caption := TimeToStr(Now);
> end;
>
> Heap dump by heaptrc unit
> 974 memory blocks allocated : 1698252/1700016
> 972 memory blocks freed : 1698116/1699880
> 2 unfreed memory blocks : 136
> True heap size : 753664
> True free heap : 753056
> Should be : 753272
> Call trace for block $012AE390 size 16
> $000100010CEB
> $000100012D87
> $000100012608
> $00010018985D
> $000100189C59
> $000100189622
> $000100189551
> $00010003AA64 line 39 of unit1.pas
> Call trace for block $0129E7B0 size 120
> $000100010C12
> $0001DF57
> $0001001897FA
> $000100189C59
> $000100189622
> $000100189551
> $00010003AA64 line 39 of unit1.pas
> $000100020591 line 939 of include/customform.inc___
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel