Memory Leak - Zeoslib 6.6.1 - Beta, Delphi 7, SQLite 3.3.15
Moderators: gto, cipto_kh, EgonHugeist
Memory Leak - Zeoslib 6.6.1 - Beta, Delphi 7, SQLite 3.3.15
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 ??
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 ??
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
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
Mark
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.
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.
-
- Fresh Boarder
- Posts: 10
- Joined: 11.10.2006, 21:19
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
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
-
- Fresh Boarder
- Posts: 10
- Joined: 11.10.2006, 21:19
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.
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.
-
- Fresh Boarder
- Posts: 10
- Joined: 11.10.2006, 21:19
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.