Memory leak when connect fails

Memory leak when connect fails

Postby Wade » Tue 26 Jan 2010 06:16

Delphi 2009
FB 2.1
DBXIDA 2.50.20

If a TSQLConnection fails to connect because the FB server username/password is incorrect, DBXIBA leaks memory.

Very easily reproduced by deliberately using an incorrect password when connecting to a database.

Here's the report of leaked memory:

An unexpected memory leak has occurred. The unexpected small block leaks are:

1 - 12 bytes: Unknown x 3
13 - 20 bytes: TIBCSQLTransactions x 1, TList x 1, TCRConnections x 2, Unknown x 2
21 - 28 bytes: UnicodeString x 1
29 - 36 bytes: UnicodeString x 1
37 - 44 bytes: TIBCSQLTransaction x 1, UnicodeString x 1
45 - 52 bytes: TGDSDatabaseInfo x 1
53 - 60 bytes: UnicodeString x 1
61 - 68 bytes: TGDSTransaction x 2
69 - 76 bytes: TStringList x 4
77 - 84 bytes: UnicodeString x 2, Unknown x 1
85 - 92 bytes: TIBCSQLConnection x 1
117 - 124 bytes: UnicodeString x 1
173 - 188 bytes: TGDSConnection x 1
221 - 236 bytes: Unknown x 1
1981 - 2172 bytes: Unknown x 1

A successfull connection does not generate the memory leak.
Wade
 
Posts: 31
Joined: Sun 03 Jan 2010 06:04

Postby Dimon » Fri 29 Jan 2010 14:35

Thank you for information. We are investigating this problem. As soon as we solve the problem we will let you know.
Dimon
Devart Team
 
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Postby Dimon » Mon 01 Feb 2010 12:40

I could not reproduce the problem.
Please try to compose a small sample to demonstrate the problem and send it to dmitryg*devart*com.
Dimon
Devart Team
 
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Postby Wade » Mon 08 Feb 2010 01:13

No need to send an example - it is absolutely simple to reproduce like this:

uses
SqlExpr, DbxIdaDriverLoader;

procedure TForm1.Button1Click(Sender: TObject);
var
SQLCon: TSQLConnection;
begin
ReportMemoryLeaksOnShutdown := True;

SQLCon := TSQLConnection.Create(nil);
try
SQLCon.DriverName := DbxIdaDriverLoader.sBuiltinDriverName;

SQLCon.LoginPrompt := False;
SQLCon.Params.Clear;
SQLCon.Params.Add('User_Name=' + 'XXX');
SQLCon.Params.Add('Password=' + 'YYY');
SQLCon.Params.Add('Database=' + 'C:\ZZZ.FDB');
try
SQLCon.Open;
except
on E:Exception do
Application.ShowException(E);
end;
finally
SQLCon.Free;
end;

Close;
end;
Wade
 
Posts: 31
Joined: Sun 03 Jan 2010 06:04

Postby Plash » Tue 09 Feb 2010 10:58

This is a bug of dbExpress. It does not free the connection handle if an error occurs.
Plash
Devart Team
 
Posts: 2844
Joined: Wed 10 May 2006 07:09

Postby Wade » Tue 09 Feb 2010 11:08

But most of the objects not being freed are Devart classes, so surely you can put in appropriate resource protection to free your own objects - either immediately or at least when shutting down?
Wade
 
Posts: 31
Joined: Sun 03 Jan 2010 06:04


Return to dbExpress driver for InterBase & Firebird