7.0.5 Memory leak

The stable tester's forum for ZeosLib 7.0.x series

Report problems concerning our Delphi 2009+ version and new Zeoslib 7.0 features here.
Post Reply
Alfa000
Fresh Boarder
Fresh Boarder
Posts: 18
Joined: 05.12.2012, 09:09

7.0.5 Memory leak

Post by Alfa000 »

Hello

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.

I don't know why, but i try break code in finalization part of unit ZDbcMySql

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!
Maybe problem is here: I tried insert breakpoint to method TZAbstractDriver.Destroy but this method was never executed!
Daniel Andrascik
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Re: 7.0.5 Memory leak

Post by EgonHugeist »

I'm not 100% sure yet. But ReportMemoryLeakOnShutDown is an annoying theme:

It doesn't check MemLeaks which are freed after finalization. The IZDriverManager is already alive which contains a clone of the Driver. That's why RefCount > 0.

We're using the FPC HeapTrace-Unit for detecting leaket memory, which btw. tell's us much more about leaked memory than the ReportMemoryLeakOnShutDown of Delphi. I'm planning to add FASTMM4 to our test units...

What makes me wondering: Does the destructore really never be called?
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
Alfa000
Fresh Boarder
Fresh Boarder
Posts: 18
Joined: 05.12.2012, 09:09

Re: 7.0.5 Memory leak

Post by Alfa000 »

Ok, i try FastMM4 with full debug mode on this really simple program. This program does allmost nothing. But memory leak is still reported.

Code: Select all

program LeakProj;

{$APPTYPE CONSOLE}

{$R *.res}

uses
  FastMM4, //FullDebugMode enabled
  System.SysUtils, ZDbcIntfs, ZDbcMySql;

var
  sConString: string;
  LZeos: IZConnection;
begin
  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.
MadExcept and EurekaLog still reports memory leak too. I attach reports files from FastMM and MadExcept.

Main point is, that no memory leaks occurs in previous stable version of ZeosLib - 7.0.4.

In this simple program i place four breakpoint into these constructors and destructors:

TZAbstractDriver.Create
TZAbstractDriver.Destroy
TZAbstractConnection.Create
TZAbstractConnection.Destroy

If i use zeoslib 7.0.4 then program stops once in every of these methods.

But if i use zeoslib 7.0.5 then program stops only in constructors.

Sorry for my poor English.

Daniel Andrascik
You do not have the required permissions to view the files attached to this post.
Daniel Andrascik
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Re: 7.0.5 Memory leak

Post by EgonHugeist »

Have to correct my selves.

Found the bug and did solve this issue.
Patch done R2722 \testing 7.1

Hmpf annoying after releasing 7.0.5, realy. Switch to SVN..
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
Alfa000
Fresh Boarder
Fresh Boarder
Posts: 18
Joined: 05.12.2012, 09:09

Re: 7.0.5 Memory leak

Post by Alfa000 »

Daniel Andrascik
fhaut
Junior Boarder
Junior Boarder
Posts: 29
Joined: 10.04.2009, 15:55

Re: 7.0.5 Memory leak

Post by fhaut »

hi

using the zeos 7.0.5a-stable still remain the memory leak...
Image
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Re: 7.0.5 Memory leak

Post by EgonHugeist »

Where did you get 7.0.5a from? SVN?
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
fhaut
Junior Boarder
Junior Boarder
Posts: 29
Joined: 10.04.2009, 15:55

Re: 7.0.5 Memory leak

Post by fhaut »

yes

from SVN at svn://svn.code.sf.net/p/zeoslib/code-0/tags/7.0.5a-stable
Image
fhaut
Junior Boarder
Junior Boarder
Posts: 29
Joined: 10.04.2009, 15:55

Re: 7.0.5 Memory leak

Post by fhaut »

EgonHugeist

you have found the SVN repository ? or there is a other repository address where the memleak is solved ?

fhaut wrote:yes

from SVN at svn://svn.code.sf.net/p/zeoslib/code-0/tags/7.0.5a-stable
Image
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Re: 7.0.5 Memory leak

Post by EgonHugeist »

Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
fhaut
Junior Boarder
Junior Boarder
Posts: 29
Joined: 10.04.2009, 15:55

Re: 7.0.5 Memory leak

Post by fhaut »

Works fine,

Thank you
Image
Post Reply