Memory Leak - Zeoslib 6.6.1 - Beta, Delphi 7, SQLite 3.3.15

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
Gagatek
Fresh Boarder
Fresh Boarder
Posts: 1
Joined: 10.04.2007, 11:08

Memory Leak - Zeoslib 6.6.1 - Beta, Delphi 7, SQLite 3.3.15

Post by Gagatek »

I have problem with memory leak when i use TZTable. Table has about 1000 records (10 columns). Every time when i call Refresh method program eat about 1 MB avaliable system memory.
This problem is simular to
this bug. I discover it in ver. 6.1.5 and is still present.
Is it some path for it ??
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Can you post this bug with a sample program (table definition and data load script included) to the bug tracker? As this may be a SQLite problem it may take a long time to find somebody who wants to have a look at it. Can you check if it gives the same problem with other databases? Do you use mysql somewhere? That's the database I use.

Mark
aducom
Zeos Dev Team
Zeos Dev Team
Posts: 67
Joined: 30.08.2005, 13:21

Post by aducom »

If this problem is related to Lazarus then yes....
edsoft
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: 16.10.2005, 08:06

Post by edsoft »

After Gagatek post, I did a test with an app with memory leak problems which uses some data in postgresql and transfers to a sqlite 3 DB for local use (using Delphi 7.1)

The test code was a simple timer (every 5 seconds) and the following code in the timer event:

if not dbgrid1.datasource.dataset.active
then dbgrid1.datasource.dataset.open
else dbgrid1.datasource.dataset.refresh;

The component used was TZReadOnlyQuery for both query (also, the query text is identical)

When using sqlite the memory usage climbs constantly with each refresh, whereas with postgresql remains constant.

Later I will upload the structure of the sqlite one with some data.

Please forgive my english.
jacques.bernardes
Fresh Boarder
Fresh Boarder
Posts: 10
Joined: 11.10.2006, 21:19

Post by jacques.bernardes »

Yes, it's the same bug.

More information : on queries with only 1 column the leak does not happen. With 2 or more columns, it happen even if the query returns nothing. That's why I think it's related to the structures thar hold the columns information.

I also observed that if you compile the program using Delphi, the leak is smaller, so, the source of the bug could be fpc.


That's it.


Jacques
aducom
Zeos Dev Team
Zeos Dev Team
Posts: 67
Joined: 30.08.2005, 13:21

Post by aducom »

OK, I would appreciate a small sample with the problem and I'll look into it. Please mail it to support at aducom dot com without exe.

albert
jacques.bernardes
Fresh Boarder
Fresh Boarder
Posts: 10
Joined: 11.10.2006, 21:19

Post by jacques.bernardes »

The code is below...



program Memleak;

{$mode objfpc}{$H+}

uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Classes,
SysUtils, ZConnection, ZDataSet;

var C : TZConnection;
var Q : TZQuery;
begin
c:=TZConnection.Create(nil);
q:=TZQuery.Create(nil);
c.Database:='mysql';
c.Protocol:='mysql-4.1';
c.HostName:='192.168.0.1';
c.User:='root';
c.Password:='root';
q.Connection:=c;
q.SQL.Clear;
q.SQL.Add('SELECT user, password from user limit 3;');
c.Connect;
while 1=1 do begin
q.Open;
q.Close;
end;
q.Free;
c.Free;
{ TODO -oUser -cConsole Main : Insert code here }

end.
jacques.bernardes
Fresh Boarder
Fresh Boarder
Posts: 10
Joined: 11.10.2006, 21:19

Post by jacques.bernardes »

I think it´s a FPC bug. Under Lazarus it freezes my computer after 30 seconds ! Under Delphi 6.0, works as I expect...

Best regards

Jacques
ranametal
Fresh Boarder
Fresh Boarder
Posts: 1
Joined: 03.09.2007, 22:42
Location: CR

Post by ranametal »

I have the same problem with Delphi 7. I dont' know if It is a Zeos bug or a SQLite bug, But I have attached a Delphi program example that produces this problem. Download and compile it, press the "Fill databutton" for inserting some records with random data, as more records you insert there is more memory wasted, and then press de "Reopen table button” and see in the Task manager how the memory usage of the program is increasing each time you press the "Reopen" button
You do not have the required permissions to view the files attached to this post.
Post Reply