Hello,
I made a simple service like this:
function TMyService.AllReport: TStream;
begin
Result := TStringStream.Create('{"name":"Hans","Address":[{"new":"98st"},{"old":"123st"}]}');
TXDataOperationContext.Current.Handler.ManagedObjects.Add(Result);
end;
then the client accesses with a code like this:
procedure TForm1.Button1Click(Sender: TObject);
var
Client: TXDataClient;
ms: TMemoryStream;
sResp: string;
begin
Client := TXDataClient.Create;
ms := TMemoryStream.Create;
try
Client.Uri := 'http://localhost:2001/guest';
ms.LoadFromStream(Client.Service<IMyService>.AllReport);
SetString(sResp, PAnsiChar(ms.Memory), ms.Size);
Memo1.Text := sResp;
finally
Client.Free;
ms.Free;
end;
end;
on the client there will be a TBytestream memory leak.
Please help, which part of the code is wrong
thank you