I have this function
function doHTTPRequest(const AUrl: String): String;
// ------------------------------------------------------------------------
// return the response for a http request
var
aIdHTTP : TIdHTTP;
begin
Result := '';
aIdHTTP := TIdHTTP.Create(nil);
try
aIdHTTP.HandleRedirects := true;
aIdHTTP.RedirectMaximum := 5;
aIdHTTP.ConnectTimeout := 5000;
aIdHTTP.ReadTimeout := 10000;
Result := aIdHTTP.Get(aUrl);
aIdHTTP.Disconnect(false);
if Assigned(aIdHTTP.IOHandler) then
aIdHTTP.IOHandler.InputBuffer.Clear;
finally
if Assigned(aIdHTTP) then FreeAndNil(aIdHTTP);
end;
end;
Every time I call this function, the process in "task manager" increase private working set memory of 200 Byte (more or less).
where am I wrong?
I already use FastMM and AQTime but no memory leak have been found
this is an example of what i can see in task manager, from the begin
to end
the memory is increased by 200 Byte and it is never released...
doHTTPRequest
begin = 3.480 KB
end = 3.652 KB
----------------
diff. 184 Byte
doHTTPRequest
return value is html string (about 20 KB)
doHTTPRequest
is called by TIdHttpServer
like this:
procedure TServer.CommandGet(AContext: TIdContext; ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
begin
AResponseInfo.ContentText := doHTTPRequest('http://example.com/foo.html');
end