Topic about possible Memory leak in ZDbcIntfs

The forum for ZeosLib 7.2 Report problems. Ask for help, post proposals for the new version and Zeoslib 7.2 features here. This is a forum that will be edited once the 7.2.x version goes into RC/stable!!

My personal intention for 7.2 is to speed up the internals as optimal a possible for all IDE's. Hope you can help?! Have fun with testing 7.2
Post Reply
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1956
Joined: 17.01.2011, 14:17

Topic about possible Memory leak in ZDbcIntfs

Post by marsupilami »

While cleaning up the Forums from Spam I accidetally deleted a new topic about possible memory leaks in ZDBCIntfs. Please recreate the topic. It might be possible that you will have to reregister your user name, if you didn't post any topics in the past.

Best regards,

Jan
anfm
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 14.03.2023, 13:44
Location: Tatui-SP-Brasil
Contact:

Re: Topic about possible Memory leak in ZDbcIntfs

Post by anfm »

https://sourceforge.net/p/zeoslib/code- ... cIntfs.pas
ZDbcIntfs-garbage.png
ZDbcIntfs-garbage-alt.png
You do not have the required permissions to view the files attached to this post.
User avatar
aehimself
Zeos Dev Team
Zeos Dev Team
Posts: 796
Joined: 18.11.2018, 17:37
Location: Hungary

Re: Topic about possible Memory leak in ZDbcIntfs

Post by aehimself »

It won't leak, it's an interface:

private
FDriversCS: TCriticalSection; // thread-safety for FDrivers collection. Not the drivers themselves!
FLogCS: TCriticalSection; // thread-safety for logging listeners
FDrivers: IZCollection;
FLoggingListeners: IZCollection;
FGarbageCollector: IZCollection;
Delphi 12.2, Zeos 8 from latest GIT snapshot
Using:
- MySQL server 8.0.18; libmysql.dll 8.0.40 x64 5.7.19 x68, libmariadb.dll 3.3.11
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.15
- MSSQL 2012, 2019; sybdb.dll FreeTDS_3102
- SQLite 3.47
anfm
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 14.03.2023, 13:44
Location: Tatui-SP-Brasil
Contact:

Re: Topic about possible Memory leak in ZDbcIntfs

Post by anfm »

I have this erros on Lazarus 2.2.0
zeos-ml.png
heaptrclog-zeos.txt
You do not have the required permissions to view the files attached to this post.
User avatar
aehimself
Zeos Dev Team
Zeos Dev Team
Posts: 796
Joined: 18.11.2018, 17:37
Location: Hungary

Re: Topic about possible Memory leak in ZDbcIntfs

Post by aehimself »

The log points to the unit initialization of ZDbcIntFs, which looks like this:

Code: Select all

initialization
  DriverManager := TZDriverManager.Create;
  GlobalCriticalSection := TCriticalSection.Create;
finalization
  DriverManager := nil;
  FreeAndNil(GlobalCriticalSection);
These variables are global, defined like:

Code: Select all

var
  /// <summary>The common driver manager object.</summary>
  DriverManager: IZDriverManager;
  /// <summary>The global critical section.</summary>
  GlobalCriticalSection: TCriticalSection;
Finalization correctly seems to free up these objects. Is it possible that your app exits ungracefully (or by using Halt) so uninitializations aren't executed?
Delphi 12.2, Zeos 8 from latest GIT snapshot
Using:
- MySQL server 8.0.18; libmysql.dll 8.0.40 x64 5.7.19 x68, libmariadb.dll 3.3.11
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.15
- MSSQL 2012, 2019; sybdb.dll FreeTDS_3102
- SQLite 3.47
Post Reply