Search found 1 match

by AliakseiY
Wed 16 Feb 2022 09:43
Forum: SecureBridge
Topic: TScHttpWebRequest memory leak
Replies: 3
Views: 9285

TScHttpWebRequest memory leak

Hi,
I am trying to requst a web interface with a http post command.
Everything is going well and I get a response (xml string) from the interface .
But while executing this task up to 1.3 Gb RAM is being used.
If the request has been done, up to 600 Mb of memory ist still being used by the programm.

Can you support me with this issue?
Thanks.

It is my delphi code (RAD Studio 10.1 Berlin):

procedure Tfrmmain.btnrequestClick(Sender: TObject);
var
Response: TScHttpWebResponse;
ResponseStr: string;
buff: TBytes;
xml: String;
igspn: TScHttpWebRequest;
begin
try
xml:= ' ### original xml string ###';

igspn:= TScHttpWebRequest.Create(Application);
igspn.RequestUri:= '### original URL ###';
igspn.ContentType:= 'text/xml';
igspn.KeepAlive:= true;
igspn.Method:= rmPOST;
igspn.headers.Add('Authorization','Basic '+ TBase64Encoding.Base64.Encode('##username##+ ':' + '##password##'));
buff:= TEncoding.UTF8.GetBytes(xml);
igspn.ContentLength:= Length(buff);
igspn.WriteBuffer(buff);
igspn.SendChunked := false;
Response:= igspn.GetResponse;
memo1.Lines.Text:= Response.ReadAsString;
FreeAndNil(response);
except on e: Exception do begin
ShowMessage(e.Message);
end;
end;
end;