[fpc-pascal] Memoryleak in SQLite3db.TSqlite?

Michael Fuchs freepascal at ypa-software.de
Tue Oct 16 12:59:24 CEST 2012


Hello,

I wrote a simple test program with SQLite3db

program SqliteMemoryLeak;
{$mode objfpc}{$H+}

uses
   HeapTrc, {$IFDEF UNIX}{$IFDEF UseCThreads}CThreads,{$ENDIF}{$ENDIF}
   Classes, SysUtils, SQLite3db;

var
   X: TSQLite;
   S: TStringList;

begin
   try
     S := TStringList.Create;
     X := TSqlite.Create('test.sqlite');
     X.Query('SELECT * FROM FIRM', S);
   finally
     FreeAndNil(X);
     FreeAndNil(S);
   end;
end.

It works, but the heap trace shows a bunch of memory leaks.
The trace could be found under:
http://michael-fuchs.net/newsgroups/fpc-pascal/sqlitememoryleak.trc

Even this produces an unfreed memory message:

begin
   try
     X := TSqlite.Create('test.sqlite');
   finally
     FreeAndNil(X);
   end;
end.

Is this a bug or am I doing something wrong?

Michael



More information about the fpc-pascal mailing list