Memory Leaks when Monitoring

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for InterBase & Firebird in Delphi and C++Builder
Post Reply
Posts: 6
Joined: Tue 15 May 2007 20:06
Location: Athens, Greece

Memory Leaks when Monitoring

Post by yoda » Thu 24 May 2007 09:47

Hi, it seems that when we have attached an sqlmonitor to an sqlconnection then the driver is leaking about 1KB per executed command.

Since I'm a registered user of your DBXpress for Oracle professional driver (that is i have the source code) i took the liberty to look at the source code of this driver (in a hunch that the areas of the drivers that are not DB specific it will have the same implementation) and saw that the it allocates a tracing structure (which contains a 1KB buffer) which it never deallocates. Now it could be said that it is our application's responsibility to dealloc that (which is passed to us as a pointer) but this is not possible since the allocation is done through the memory manager and not by means of VirtualAlloc or some other OS function. that means that we CANNOT dealloc that memory even if someone has told us that we should (which hasn't - the borland's documentation on the tracing events does NOT state that we should dealloc the memory pointer to by the passed in pointer) since the application and the driver are not using the same instance of the memory manager (they probably use the same kind of memory manager but not the same instance).

So, I think that this is VERY important to be fixed (in all of your drivers i suspect) since leaking about 1KB per command executed is too much and makes your drivers unusable in situations where sql-monitoring is essential.

PS: to be fair the same behavior is exhibited also by Borland's interbase driver (and i suspect all other drivers too).


Post Reply