You are not logged in.
Hi,
I noticed that the construction of an TSQLDBWinHTTPConnectionProperties instance fails with an exception if the server is not available or the login information is incorrect.
As the exception happens in the constructor it leaks 504 bytes each time.
Overwriting the constructor and putting the inherited in a try except does not work either. Access violations happens on destroying the not fully created instance.
constructor TMyWinHTTPRemoteConnectionProperties.Create(const aServerName, aDatabaseName, aUserID, aPassWord: RawUTF8);
begin
try
inherited;
except
self.Free;
raise;
end;
end;
Also destroying a TSQLDBWinHTTPConnectionProperties instance where the server got unavailable results in an exception. I assume that also the memory of this instance won't be released.
Is this the expected behaviour?
thanks,
Matthias
Offline
Offline
ok, granted. Didn't know that yet.
But nevertheless the exception in the constructor seems to cuase a memory leak with 504 bytes each time.
I used this code to measure the memory consumption before and after the object creation. I instanced a TSQLDBWinHTTPConnectionProperties with a unused server port.
function GetMemoryUsed: int64;
var
ManagerState: TMemoryManagerState;
BlockTypeState: TSmallBlockTypeState;
begin
{$WARN SYMBOL_PLATFORM OFF}
GetMemoryManagerState(ManagerState);
{$WARN SYMBOL_PLATFORM ON}
result := ManagerState.TotalAllocatedMediumBlockSize + ManagerState.TotalAllocatedLargeBlockSize;
for BlockTypeState in ManagerState.SmallBlockTypeStates do
result := result + BlockTypeState.UseableBlockSize * BlockTypeState.AllocatedBlockCount;
end;
Offline