General question about memory free in xdata service implementation

Hi,

I have implementation one of the service method like this:

function TMainService.getSomething(): TList;
begin
var aList:TList:=TList.Create;
try
aList.Add('benefname');
aList.Add('beneflocaddress');
Result:=aList;

finally
FreeAndNil(aList);
end;
end;

When I do FreeAndNil(aList); the method response in client side is empty.
Should I do this in this way or without object frees?
The XData free this object alone or I will have memory leak?

You should not destroy the list, otherwise XData won't be able to read it to build the response. Leave it alone, XData will destroy it. More info:

https://download.tmssoftware.com/business/xdata/doc/web/server_memory_management.html

Ok ... thank you ... XData is power software :muscle:

1 Like

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.