Memory leaks in LiteDac 2.7.26

Discussion of open issues, suggestions and bugs regarding LiteDAC (SQLite Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Max Terentiev
Posts: 19
Joined: Sun 05 Jun 2016 17:11

Memory leaks in LiteDac 2.7.26

Post by Max Terentiev » Sat 31 Dec 2016 02:04

Hi,

TLiteQuery leaks memory each Open/Close !

See screenshot of AQTime profiler:

Image

Steps to reproduce:

Drop TLiteConnection and TLiteQuery on the form
LiteConnection.Options.Direct:=false;

LiteQuery.Sql.Add('SELECT * FROM SomeTable');
LiteQuery.Open;
LiteQuery.Close;

Close program. See Allocation profiler results.

Important note: LiteDac compiled with {$DEFINE NOSTATIC} because of this problem:
viewtopic.php?f=48&t=34243

Enviroment: RAD Studio Berlin Update 2, AQTime Pro 8.21

MaximG
Devart Team
Posts: 1019
Joined: Mon 06 Jul 2015 11:34

Re: Memory leaks in LiteDac 2.7.26

Post by MaximG » Tue 03 Jan 2017 12:24

We've examined the behavior of the latest version of LiteDAC 2.7.27 using AQtime Pro 8.60 in accordance with your description. Unfortunately we were unable to detect memory leaks. Please let us know whether it is possible to detect memory leaks in the environment using other memory managers (FastMM 4, MadExcept or EurekaLog). Does this problem occur when using the latest version of LiteDAC 2.7.27 ?

Max Terentiev
Posts: 19
Joined: Sun 05 Jun 2016 17:11

Re: Memory leaks in LiteDac 2.7.26

Post by Max Terentiev » Tue 03 Jan 2017 18:32

Ok, I will try with 2.7.27 and report back.

Max Terentiev
Posts: 19
Joined: Sun 05 Jun 2016 17:11

Re: Memory leaks in LiteDac 2.7.26

Post by Max Terentiev » Tue 17 Jan 2017 04:05

Hi,

I tested version 2.7.27 and have same memory leaks problems.

Tested with C++Builder Berlin update 2 + CodeGuard
Tested with C++Builder Berlin update 2 + AQTime
Tested with Delphi Berlin update 2 + EurekaLog 7.50

Here is scrrenshot of EurekaLog memory leak report:

Image

Here is a code of my sample project:

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
var
  lq:TLiteQuery;
begin
lq:=TLiteQuery.Create(nil);
lq.Connection:=Database;
lq.SQL.Add('SELECT * FROM List2');
lq.Open;
lq.Close;
lq.Free;
ShowMessage('OK');
end;
Here is TLiteConnection options from Form.dfm:

object Database: TLiteConnection
Database = 'C:\Data\core.db'
ClientLibrary = 'C:\sqlite\sqlite3.dll'
Options.BusyTimeout = 10
Options.ReadUncommitted = True
Options.ForceCreateDatabase = True
LoginPrompt = False
Left = 257
Top = 78
end

Here is DDL of List2 table wich used in sql query:

Code: Select all

CREATE TABLE List2 (
    ID       INTEGER       PRIMARY KEY AUTOINCREMENT
                           NOT NULL,
    Email    VARCHAR (100) NOT NULL,
    FullName VARCHAR (100),
    zzz      VARCHAR (25),
    nnn      VARCHAR (50),
    bb       VARCHAR (50),
    zz       INTEGER,
    kkk      DATE,
    ddde     VARCHAR (50) 
);
{$DEFINE NOSTATIC} has been added to LiteDac.inc
LiteDAC compiled using \LiteDAC\Source\Delphi24\make.bat

If you need any additional details - ask me !

Hope you can fix problem soon !

Here is a full EurekaLog memory leak report:
https://yadi.sk/i/2Hs1kNLH39NfNR

MaximG
Devart Team
Posts: 1019
Joined: Mon 06 Jul 2015 11:34

Re: Memory leaks in LiteDac 2.7.26

Post by MaximG » Mon 23 Jan 2017 09:14

We have checked work LiteDAC 2.7.27 for RAD Studio 10.1 Berlin Update 2 with EurekaLog 7.50 according to your description and found no issues. Please specify what exact version of the client sqlite3.dll library you are using in your tests. Are there any memory leaks in your projects when using Direct Mode ?

Max Terentiev
Posts: 19
Joined: Sun 05 Jun 2016 17:11

Re: Memory leaks in LiteDac 2.7.26

Post by Max Terentiev » Mon 23 Jan 2017 11:56

Hi,

We built sqlite.dll with folowing options:

SQLITE_ENABLE_ICU
SQLITE_CASE_SENSITIVE_LIKE

ICU library statically linked to sqlite.dll

p.s. I checked LiteDAC with default .dll from sqlite.org and found NO memory leaks ! Looks like LiteDAC conflicts with these options.

But we need above options, at least SQLITE_ENABLE_ICU. And LiteDAC should handle sqlite with ICU plugin enabled. If you need - I can send our MSVC project for sqlite.dll building from amalgamation sources.

MaximG
Devart Team
Posts: 1019
Joined: Mon 06 Jul 2015 11:34

Re: Memory leaks in LiteDac 2.7.26

Post by MaximG » Tue 25 Apr 2017 05:18

When developing and testing our products to work with SQLite we use only standard SQLite library available on the official project site : http://sqlite.org

Post Reply