If i try this simple project, then memory manager generate memory leak mesage:
Code: Select all
program LeakProj;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils, ZDbcIntfs, ZDbcMySql;
var
sConString: string;
LZeos: IZConnection;
begin
ReportMemoryLeaksOnShutdown := True;
sConString := Format('zdbc:%s://%s:%d/%s?UID=%s;PWD=%s', ['mysql-5', '127.0.0.1', 4434, 'aslibex_dunit_zeos', 'root', '']);
LZeos := DriverManager.GetConnection(sConString);
LZeos := nil;
end.
Code: Select all
initialization
MySQLDriver := TZMySQLDriver.Create;
DriverManager.RegisterDriver(MySQLDriver);
finalization
if DriverManager <> nil then
DriverManager.DeregisterDriver(MySQLDriver);
MySQLDriver := nil; //<< In this place MySQLDriver ref count have value 2!
end. //<< In this place MySQLDriver ref count have still value 1! MySQLDriver is never destroyed!