You are not logged in.
Hello Again, (Time for Multiple Posts )
So, We are consuming a Interface-Service, as Client-to-Server and Server-To-Self,In the Client-To-Server we don't have a memory Leak, and in the server-to-Self side It Works Perfectly!, BUT, i'm having some trouble with Memory Leak in the Server side with this TDDDRepositoryRestFactory, Sorry if the Code is big , if so i will put in a pastebin!
ffactory := TDDDRepositoryRestFactory.Create(FServer);
FServer.ServiceContainer.InjectResolver([ffactory]);
FServer.Services.Resolve(IDomSaleQuery, cmd);
try
Result := False;
if cmd.SelectAll = CqrsSuccess then
begin
cmd.GetAll(Sale);
Result := True;
end;
finally
ffactory := nil;
ffactory.free;
end;
and we think it might be the Repo Fault, but we didn't find the reason, any suggestion for what could be??
function TRepoVenda.GetAll(out aAllAggregate: TVendas): TCQRSResult;
begin
Result:= ORMGetAllAggregates(aAllAggregate);
end;
function TRepoVenda.SelectAll: TCQRSResult;
begin
Result := ORMSelectAll('',[]);
end;
Last edited by Shadownildo (2019-06-13 11:41:10)
Offline
Correct the order of these lines:
finally
ffactory.free; //first
ffactory := nil; //second
end;
Offline
Correct the order of these lines:
finally ffactory.free; //first ffactory := nil; //second end;
Thank you For the Answer!
But ths not solve the problem , we are Studying the RegressionTests in dddInfraRepoUser, and thinking how manage the Memory... What happen is ,
We have a ClientDriven Service that >
Connect To the Server >
And Inside this Service, we Start Another Connection With the Own Server that Define and Call's Other Service .
function TVendaService.Include(const DadosVenda: TVenda): boolean; // This is the ClientDriven Service
var
cmd: IDomSaleCommand;
ffactory: TRepoSaleFactory;
begin
ffactory := TDDDRepositoryRestFactory.Create(FServer);
FServer.ServiceContainer.InjectResolver([ffactory]);
FServer.Services.Resolve(IDomSaleQuery, cmd); // This is the Inside Service that is a ICQRSService
When we Free the ClientDriven Service, Clean the Client > Server Memory and it's OK, But, The Inside Service that is a ICQRSService ,Remains in the Memory, and Only gone if we Free the RestServer like is done in the RegressionTests in dddInfraRepoUser.pas, But in a real Scenario we can't Free the RestServer Connection after using one service .
Offline