I experience one weird problem.
I use Delphi and Indy to upload and backup some files. It runs just fine on many computers (Win7 64bit, WinXP) . CPU usage is less then 1% and max. 20MB in RAM.
But there is one computer (Win 2008 R2) where it is problematic and I can't find out why. CPU usage is 5-20%, it takes 100MB+ in RAM and it increases a lot. Furthemore "page fault" rises a lot, eg. 100 000 every second (not increasing on my computer)
Code is very simple
var
IdHTTP: TIdHTTP;
IdPostData: TIdMultiPartFormDataStream;
sResponse: string;
begin
IdHTTP := TIdHTTP.Create(nil);
IdPostData:=TIdMultiPartFormDataStream.Create;
try
IdPostData.AddFile('file', 'C:\data.dat', '');
sResponse:=IdHTTP.Post('http://web.com', IdPostData);
ShowMessage(sResponse);
finally
IdHTTP.Free;
IdPostData.Free;
end;
end;
Does anybody have any idea why "page fault" increases that a lot? Is it possible that there is some hardware issue? How to find it?
just put "IdHttp := nil; IdPostData:=nil; sResponse := 'Ok'; " before "try" clause and try again
--reviewed-- Changed your code a little bit
procedure SendFile;
var
IdHTTP: TIdHTTP;
IdPostData: TIdMultiPartFormDataStream;
sResponse: string;
begin
sResponse := 'OK';
IdHTTP := TIdHTTP.Create(nil);
IdPostData:=TIdMultiPartFormDataStream.Create;
try
IdPostData.AddFile('C:\data.dat', 'data.dat', '');
IdHTTP.Post('http://www.yahoo.com', IdPostData);
ShowMessage(sResponse);
finally
IdHTTP.Free;
IdPostData.Free;
end;
end;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With