XDataClient and iOS Memory usage

Hi,

I have done some testing with Instruments under iOS with the following test code, I'm calling them on a NSTimer using ITask:

Any hints for iOS or there is a memory leak on XData and iOS?

Thanks in advance,

Omar Zelaya

//// this method does not increse memory on each call, it keeps constant usage
procedure TestMemoryUsage1;
var
  xClient : TXDataClient;
  MyService : IMyService;
begin
  xClient := TXDataClient.Create;
  xClient.HttpClient.OnSendingRequest := procedure(Req: THttpRequest)
    begin
      Req.Timeout := 10000; // 5 seconds
    end;
  xClient.UserName := 'XX';
  xClient.Password := 'XX';
  xClient.Uri := 'https://www.XXX.com:2001/tms/xdata';
  MyService := xClient.Service<IMyService>;
  MyService := nil;
  xClient := nil;
end;

//// this method does increse memory usage on each call
procedure TestMemoryUsage2;
var
  xClient : TXDataClient;
  MyService : IMyService;
  iCount : integer;
begin
  xClient := TXDataClient.Create;
  xClient.HttpClient.OnSendingRequest := procedure(Req: THttpRequest)
    begin
      Req.Timeout := 10000; // 5 seconds
    end;
  xClient.UserName := 'XX';
  xClient.Password := 'XX';
  xClient.Uri := 'https://www.XXX.com:2001/tms/xdata';
  MyService := xClient.Service<IMyService>;
  iCount := MyService.GetIntNumber;
  MyService := nil;
  // xClient.DosposeOf; <- Added for test with same results
  xClient := nil;
end;


Hello, IMyService is implemented using Delphi class TVirtualInterface. That's the mechanism used to implement the GetIntNumber method call at runtime. Unfortunately, TVirtualInterface has a memory leak. It's a Delphi issue: https://quality.embarcadero.com/browse/RSP-10177



Wagner R. Landgraf2017-05-02 04:46:41