I have a service function in XData server with using Aurelius.
I have made 2 tests. One with TCriteria<T> and one without.
The Criteria-Version show a memory leak. See picture:
Here is the code
function TdmDatabasePerson.SearchCount(const AFilter: string): integer;
var
Criteria: TCriteria<TPerson>;
LSession: IDBSession;
begin
LSession := TDBSession.Create( DBConnection);
Criteria := LSession.objManager.Find<TPerson>;
Criteria.Add( Linq.Contains( 'Firstname', AFilter));
Result := Criteria.Select( Linq['PersonID'].Count).UniqueValue.Values[0];
end;
A "Criteria.Free" makes an AccessViolation
This Code produces no memory leak
function TdmDatabasePerson.SearchCount(const AFilter: string): integer;
var
Criteria: TCriteria<TPerson>;
LSession: IDBSession;
begin
LSession := TDBSession.Create( DBConnection);
Result := 8;
end;