Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Memory leak on simple HTTPRIO

62 views
Skip to first unread message

JanBELon

unread,
Jul 31, 2013, 12:13:04 PM7/31/13
to
Hi all,

I'm experiencing a memory leak on a very small and simple test project, I have my webservice defined as followed:

-------------------------------
type
TSimpleWebService = class
protected
FHTTPRIO : THTTPRIO;
public
constructor Create(URL : String);
property HTTPRIO : THTTPRIO read FHTTPRIO;
end;

implementation

constructor TSimpleWebService.Create(URL : String);
begin
FHTTPRIO := THTTPRIO.Create(nil);
FHTTPRIO.URL := URL;
end;
-------------------------------

Testing the webservice as followed (CustomerCare is my webservice interface):

-------------------------------
procedure TfrmMain.Button1Click(Sender: TObject);
var
webservice: customercare;
begin
webservice := GetSimpleCustomerCareService;
webservice := nil;
frmMain.Close;
end;

function TfrmMain.getSimpleCustomerCareService: CustomerCare;
var
webservice: TSimpleWebService;
begin
webservice := TSimpleWebService.Create('http://this.is.a.test');
Result := webservice.HTTPRIO as CustomerCare;
end;
-------------------------------

When I click Button1, I get no errors, except at frmMain.Close. With ReportMemoryLeaksOnShutDown := True, I get an unexpected memory leak of 12 bytes on TSimpleWebService. I have tried adding a destructor Destroy but it is not even called.

What am I doing wrong?

Thanks for your input guys,
Jan
0 new messages