Memory leaks?

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
yeohray
Posts: 56
Joined: Mon 26 Mar 2007 01:25

Memory leaks?

Post by yeohray » Sun 09 Sep 2007 17:07

Using:
Delphi 7, SDAC 4.10.0.10, kbmMemtable 5.52, FastMM 4.78

Test data:
CREATE TABLE test (col1 char(5), col2 nvarchar(128))
INSERT INTO test values ('0', 'ABC')

Code:

Code: Select all

  qryMain.SQL.Text := 'SELECT * FROM test';
  qryMain.Open;

  mem1.LoadFromDataset(qryMain, [mtcpoStructure]);
where
qryMain = TMSQuery using default properties
mem1 = kbmMemtable using default properties

FastMM reports a leak for every TStringField.GetValue for the first column. The strange thing is, if the 2nd field was a char instead of a varchar, no leaks are reported.

Is this something to be concerned about? Thanks.

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Mon 10 Sep 2007 10:39

The reason of this memory leak is a bug in the TStringField class implementation. This is a standard VCL class.
It looks like kbmMemtable has no avoidance to this problem.
The problem will appear if you replace SDAC components with analogous ADO components.

In order to avoid this problem, you can try use the TVirtualTable component. The Assign method of TVirtualTable serves for loading data from another dataset.

yeohray
Posts: 56
Joined: Mon 26 Mar 2007 01:25

Post by yeohray » Mon 10 Sep 2007 15:55

Thanks for looking into this. I will give TVirtualTable a try.

Do you know if this bug is fixed in later versions of Dephi e.g. 2007?

Thanks.

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Tue 11 Sep 2007 08:52

I tested this issue with Delphi 2007 for Win 32, and have not noticed such memory leak. I used version 11.0.2627.5503.

Post Reply