Home › Forums › kbmMemTable › Memory leak on when filter is enabled
- This topic has 1 reply, 2 voices, and was last updated 4 years, 10 months ago by
kimbomadsen.
-
AuthorPosts
-
-
February 24, 2021 at 15:03 #55503
bpranoto
ParticipantDear Kim,
I just found a memory leak on TKbmMemTable when a filter is set.
I am using lazarus 2.0.10/fpc 3.2.0 on ubuntu 18.04.
To demonstrate the problem, just create a simple project with one form. On the form drop a TKbmMemtable component, and set the project options as follows:
Project -> Project Options -> Compiler Options ->Debugging
and check Use Heaptrc unit option to detect the memory leak. Then in the constructor just write like below:
constructor TForm1.Create(AOwner: TComponent);
var
F : TField;
begin
inherited Create(AOwner);// Create field
F := TStringField.Create(Self.kbmMemTable1);
F.DataSet := Self.kbmMemTable1;
F.FieldName:=’CITY’;// Create table
Self.kbmMemTable1.CreateTable;
Self.kbmMemTable1.Open;// Set Filter
Self.kbmMemTable1.Filter:=’CITY=”SEMARANG”’;
Self.kbmMemTable1.Filtered:=True;
Self.kbmMemTable1.Open;
end;When you close the form heaptrc will report the memory leak.
Heap dump by heaptrc unit of /home/bambang/develop/lazarus/bugreport/kbmmemtable_filter_memory_leak/project1
1486 memory blocks allocated : 1745131/1747464
1484 memory blocks freed : 1744955/1747288
2 unfreed memory blocks : 176
True heap size : 655360
True free heap : 654752
Should be : 654800
Call trace for block $00007FFFF7E0A700 size 48
$00000000007EC86C ADD, line 3649 of kbmSQLElements.pas
$00000000007A231C CREATE, line 6614 of kbmMemTable.pas
$00000000007B5195 BUILDFILTER, line 13638 of kbmMemTable.pas
$00000000007AF913 SETFILTERTEXT, line 11436 of kbmMemTable.pas
$0000000000461A80 CREATE, line 52 of unit1.pas
$000000000045D881 CREATEFORM, line 2239 of include/application.inc
$000000000041E8BE main, line 19 of project1.lpr
$00000000007DE0D9 EXECUTE, line 4350 of kbmSQLParser.pas
$00000000007A2273 CREATE, line 6608 of kbmMemTable.pas
$00000000007B5195 BUILDFILTER, line 13638 of kbmMemTable.pas
$00000000007AF913 SETFILTERTEXT, line 11436 of kbmMemTable.pas
$0000000000461A80 CREATE, line 52 of unit1.pas
$000000000045D881 CREATEFORM, line 2239 of include/application.inc
$000000000041E8BE main, line 19 of project1.lpr
$00000000007AF913 SETFILTERTEXT, line 11436 of kbmMemTable.pas
$0000000000461A80 CREATE, line 52 of unit1.pas
Call trace for block $00007FFFF7F68700 size 128
$00000000007EC825 ADD, line 3647 of kbmSQLElements.pas
$00000000007A231C CREATE, line 6614 of kbmMemTable.pas
$00000000007B5195 BUILDFILTER, line 13638 of kbmMemTable.pas
$00000000007AF913 SETFILTERTEXT, line 11436 of kbmMemTable.pas
$0000000000461A80 CREATE, line 52 of unit1.pas
$000000000045D881 CREATEFORM, line 2239 of include/application.inc
$000000000041E8BE main, line 19 of project1.lpr -
March 27, 2021 at 23:37 #55611
kimbomadsen
KeymasterHi,
It is a Lazarus specific leak, which is fixed in 7.91.10.
/Kim
-
This reply was modified 4 years, 10 months ago by
kimbomadsen.
-
This reply was modified 4 years, 10 months ago by
-
-
AuthorPosts
- You must be logged in to reply to this topic.
