Page 1 of 1

Topic about possible Memory leak in ZDbcIntfs

Posted: 10.02.2023, 11:02
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

Re: Topic about possible Memory leak in ZDbcIntfs

Posted: 15.03.2023, 18:47
by anfm
https://sourceforge.net/p/zeoslib/code- ... cIntfs.pas
ZDbcIntfs-garbage.png
ZDbcIntfs-garbage-alt.png

Re: Topic about possible Memory leak in ZDbcIntfs

Posted: 16.03.2023, 19:47
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;

Re: Topic about possible Memory leak in ZDbcIntfs

Posted: 17.03.2023, 14:26
by anfm
I have this erros on Lazarus 2.2.0
zeos-ml.png
heaptrclog-zeos.txt

Re: Topic about possible Memory leak in ZDbcIntfs

Posted: 19.03.2023, 18:37
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?