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.
Alfa000
Fresh Boarder
Fresh Boarder
Posts: 17
Joined: 05.12.2012, 09:09

7.0.5 Memory leak

Postby Alfa000 » 09.09.2013, 22:09

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 Dev Team
Zeos Dev Team
Posts: 1701
Joined: 31.03.2011, 22:38

Re: 7.0.5 Memory leak

Postby EgonHugeist » 10.09.2013, 11:13

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?
King regards, Michael

You want to help? 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: 17
Joined: 05.12.2012, 09:09

Re: 7.0.5 Memory leak

Postby Alfa000 » 10.09.2013, 15:01

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 Dev Team
Zeos Dev Team
Posts: 1701
Joined: 31.03.2011, 22:38

Re: 7.0.5 Memory leak

Postby EgonHugeist » 10.09.2013, 15:19

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..
King regards, Michael

You want to help? 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: 17
Joined: 05.12.2012, 09:09

Re: 7.0.5 Memory leak

Postby Alfa000 » 10.09.2013, 16:46

Daniel Andrascik

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

Re: 7.0.5 Memory leak

Postby fhaut » 02.10.2013, 19:02

hi

using the zeos 7.0.5a-stable still remain the memory leak...
Image

User avatar
EgonHugeist
Zeos Dev Team
Zeos Dev Team
Posts: 1701
Joined: 31.03.2011, 22:38

Re: 7.0.5 Memory leak

Postby EgonHugeist » 02.10.2013, 19:23

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

You want to help? 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

Postby fhaut » 03.10.2013, 12:40

Image

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

Re: 7.0.5 Memory leak

Postby fhaut » 04.10.2013, 20:33

EgonHugeist

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


Image

User avatar
EgonHugeist
Zeos Dev Team
Zeos Dev Team
Posts: 1701
Joined: 31.03.2011, 22:38

Re: 7.0.5 Memory leak

Postby EgonHugeist » 08.10.2013, 22:51

King regards, Michael

You want to help? 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

Postby fhaut » 09.10.2013, 12:43

Works fine,

Thank you
Image


Return to “ZeosLib 7.0 Stable Forum”

Who is online

Users browsing this forum: No registered users and 1 guest