Memory leak in TFPCustomHTTPClient
Original Reporter info from Mantis: Simon Ameis @SAmeis
-
Reporter name: Simon Ameis
Original Reporter info from Mantis: Simon Ameis @SAmeis
- Reporter name: Simon Ameis
Description:
The TSocketHandler instance is not destroyed after closing the connection to the server.
A working patch is attached.
Steps to reproduce:
Just run this test project with heaptrc;
program Project1;
{$mode objfpc}{$H+}
uses
Classes, fphttpclient;
var
s: TStringList;
begin
s := TStringList.Create;
try
TFPHTTPClient.SimpleGet('http://www.freepascal.org/', s);
Writeln(s.Text);
finally
s.Destroy;
end;
end.
Additional information:
Heap dump by heaptrc unit
3270 memory blocks allocated : 1762268/1771520
3269 memory blocks freed : 1762256/1771504
1 unfreed memory blocks : 12
True heap size : 229376 (128 used in System startup)
True free heap : 229152
Should be : 229168
Call trace for block $048E18F0 size 12
$005D939D TFPCUSTOMHTTPCLIENT__CONNECTTOSERVER, line 446 of C:/FPC/trunk-src/packages/fcl-web/src/base/fphttpclient.pp
$005DAC24 TFPCUSTOMHTTPCLIENT__DOMETHOD, line 931 of C:/FPC/trunk-src/packages/fcl-web/src/base/fphttpclient.pp
$005DB20F TFPCUSTOMHTTPCLIENT__HTTPMETHOD, line 1029 of C:/FPC/trunk-src/packages/fcl-web/src/base/fphttpclient.pp
$005DB417 TFPCUSTOMHTTPCLIENT__GET, line 1065 of C:/FPC/trunk-src/packages/fcl-web/src/base/fphttpclient.pp
$005DB4DF TFPCUSTOMHTTPCLIENT__GET, line 1096 of C:/FPC/trunk-src/packages/fcl-web/src/base/fphttpclient.pp
$005DB45F TFPCUSTOMHTTPCLIENT__GET, line 1085 of C:/FPC/trunk-src/packages/fcl-web/src/base/fphttpclient.pp
$005DB5DC TFPCUSTOMHTTPCLIENT
$005DB5DC TFPCUSTOMHTTPCLIENT__SIMPLEGET, line 1156 of C:/FPC/trunk-src/packages/fc $BAADF00D of ./connector/forecastconnectorinterface.pas
Mantis conversion info:
- Mantis ID: 26063
- OS: Windows 7, 64 bit
- OS Build: 6.1 SP 1
- Build: 27643
- Platform: Desktop PC
- Version: 2.7.1
- Fixed in version: 3.0.0
- Fixed in revision: 27644 (#9191f44c)
- Target version: 2.7.1