Page 1 of 1

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

Posted: 10.04.2007, 13:05
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 ??

Posted: 12.04.2007, 13:23
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

Posted: 16.04.2007, 15:59
by aducom
If this problem is related to Lazarus then yes....

Posted: 16.04.2007, 17:41
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.

Posted: 17.04.2007, 19:32
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

Posted: 29.05.2007, 15:15
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

Posted: 11.06.2007, 22:54
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.

Posted: 11.06.2007, 22:56
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

Posted: 03.09.2007, 23:24
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