Subject Re: [IBO] IBO BUG: Resource Leak in IB_Components (verified in C++ Builder 6)
Author Geoff Worboys
Hi Zachs78,

I am not trying to argue that memory leaks are a good thing, it
was just that using DLLs in a VCL development is rather unusual.
BPLs, while effectively the same thing as DLLs, do provide
various features specific to VCL development. Nor is it
relevant to try and compare complexity. Different libraries
have different requirements, a very simple library can stretch
the bounds of an environment.

I suspect the problem will be related to TIB_Session or one of
the other globals related to normal VCL application managment.

If you can place a breakpoint in IB_Session.pas at:
procedure ReleaseSessionHookRef;

it would be interesting to see whether the line:
if InterlockedDecrement( FGDS_RefCount ) = 0 then

ever returns true (refcount = 0) when the DLL is unloaded. It
may be that additional calls to ReleaseSessionHookRef will be
needed. It seems (visually to me) that there is a mismatch in
the number of calls made in finalization sections. This does
not normally matter because in most VCL based applications the
finalization is only called on program exit.

Geoff Worboys
Telesis Computing