DataParameterArray memory leak

I have a client-server application developed in Delphi (XE2) which uses Data Abstract and RemObjects SDK (V.8.3.93.1183)
Every thing works fine except this memory leak. Every time i close the project i get this message. I’ve searched the entire project, and i could’n find the leak source. (DataParameterArray is never created ).

Thx a lot.

I can’t reproduce this case with our samples.
can you create a simple testcase that reproduces this issue, pls?
you can attach it here or send directly to support.

Hello

I was able to isolate the problem in my app and build a testcase.
Apparently the leak occurs when i execute a RemoteComand.

Hope This Helps.
Thx

TestCaseLeak.7z (4.8 MB)

this isn’t a bug.
your testcase has aOutputParameters parameter of TRORemoteCommand that is leaked.
You need to free output parameters of TRORemoteCommand manually.

Hello

I tried to free the parameters using this method but i get an Exception “Invalid pointer operation”

var
    id: integer;
    CustomerID: string;
    ParamArray:DataParameterArray;
begin
    ClientDataModule.cmd.Execute('delete',['id','CustomerID'],[id,CustomerID]);
    ParamArray   := DataParameterArray(ClientDataModule.cmd.ExecuteCall.Params.FindParam(ClientDataModule.cmd.ExecuteCall.Outgoing ParametersParameter).AsComplexType);
    ParamArray.Free;
end

THX

You need to free only output parameters with these datatypes : rtUserDefined, rtXsDateTime, rtBinary.

By other hand, you can set OwnsBinary and OwnsComplexType to true so these parameters will be fried correctly.

Could you provide a small example?

Thx a lot

procedure TClientForm.btn1Click(Sender: TObject);
var
  id: string;
begin
  id := ClientDataModule.tbl_Customers.FieldByName('id').Value;
  ClientDataModule.cmd.Execute('delete',['id'],[id]);
  ClientDataModule.cmd.ExecuteCall.ParamByName('aOutputParameters').AsComplexType.Free;
  ClientDataModule.tbl_Customers.Refresh;
end;
2 Likes