Subject Re: [firebird-support] Re: Possible memory leak in FBCLIENT.DLL
Author Stefan Heymann
> Err, are you sure that it's the fbclient.dll that's losing memory?
> Generally, an inactive dll isn't very resource hungry. Sounds to me
> as if the application isn't releasing some part of its connection.

I have written a little Delphi program to test what Bozzy said.
I don't know if it's correct to use that measurement of memory usage
but a comparison with gds32.dll from IB602 shows that fbclient.dll
decreases the dwTotalPhys value *much* faster than gds32.dll.

This is the complete program, a console application, which has no
database connection at all:

program FbClientLeak; {$APPTYPE CONSOLE}
// Does fbclient.dll leak memory?
Windows, SysUtils;
i : integer;
Handle : THandle;
MemStatus : TMemoryStatus;
i := 0;
inc (i);
Writeln ('Test ' + IntToStr (i));
Handle := LoadLibrary ('fbclient.dll');
if Handle = 0 then
Writeln ('>>> Load ERROR: ' + IntToStr (GetLastError));
if NOT FreeLibrary (Handle) then
Writeln ('>>> Free ERROR: ' + IntToStr (GetLastError));
GlobalMemoryStatus (MemStatus);
Writeln ('Free Memory: ' + IntToStr (MemStatus.dwAvailPhys) +
' of ' + IntToStr (MemStatus.dwTotalPhys) +
' = ' + FloatToStrF (MemStatus.dwAvailPhys /
MemStatus.dwTotalPhys * 100.0, ffGeneral, 5, 1) + ' %');
Sleep (50);
until false; // This will be cancelled via Ctrl+C ... ;-)

Best Regards


Stefan Heymann