Out of memory

I´m running into OutOfMemory Exceptions, when I try to retrieve using this code:


var
  list: TList<TTBLLEBENSMITTEL>;
  mgr: TObjectManager;
begin
  dsetTest.Close;
  mgr := Model.CreateManager;
  list:=mgr.Find<TTBLLEBENSMITTEL>.
  CreateAlias('tblnaehrwertlist','n').
  CreateAlias('n.naehrwertcd','nwt').
  Add(linq['lebensmittelcd'].like('B111%')).
  Add(linq['nwt.ISPORTIONSGROESSE']='Y').
  List;
  dsetTest.SetSourceList(list);
  dsetTest.Open;
end;


dsetTest is an Aurelius dataset and it is bound to an FMXLiveGrid. The Query Looks like this:


[27.01.2020 17:16:24][Trace][Value: SELECT A.HERKUNFTCD AS A_HERKUNFTCD, A.LEBENSMITTELCD AS A_LEBENSMITTELCD, A.BEZEICHNUNG AS A_BEZEICHNUNG, A.SYNONYM AS A_SYNONYM, A.DOKUNUMMER AS A_DOKUNUMMER, A.QUELLE AS A_QUELLE, A.USERINSERTDATE AS A_USERINSERTDATE, A.NOTIZ AS A_NOTIZ, A.BEARBEITER AS A_BEARBEITER, A.lebensmittelcdalt AS A_lebensmittelcdalt, A.herkunftcdalt AS A_herkunftcdalt, A.KEINEALLERGENE AS A_KEINEALLERGENE, A.ALLERGENENICHTBEARB AS A_ALLERGENENICHTBEARB, A.ZUSAMMENSETZUNGUNBEK AS A_ZUSAMMENSETZUNGUNBEK, A.ALLERGENDOKU AS A_ALLERGENDOKU, A.KEYWORDS AS A_KEYWORDS, A.firma AS A_firma, A.prodnr AS A_prodnr, A.allergentext AS A_allergentext, A.firma2 AS A_firma2, A.gtin AS A_gtin, A.synonym_old AS A_synonym_old, A.prodname AS A_prodname, A.tcminfo AS A_tcminfo, A.lminfo AS A_lminfo, A.zuloeschen AS A_zuloeschen, A.fldmemo AS A_fldmemo, A.fldtxt01 AS A_fldtxt01, A.fldtxt02 AS A_fldtxt02, A.fldtxt03 AS A_fldtxt03, A.fldnum01 AS A_fldnum01, A.fldnum02 AS A_fldnum02, A.fldnum03 AS A_fldnum03, A.DATUMSPEZI AS A_DATUMSPEZI
FROM TBLLEBENSMITTEL A
  LEFT JOIN TBLNAEHRWERT B ON (B.HerkunftCD = A.HERKUNFTCD AND B.LebensmittelCD = A.LEBENSMITTELCD)
  LEFT JOIN KATNAEHRWERT C ON (C.NAEHRWERTCD = B.NAEHRWERTCD)
WHERE  A.LEBENSMITTELCD LIKE :p_0 AND 
C.ISPORTIONSGROESSE = :p_1][Type: string]
[27.01.2020 17:16:24][Trace][Value: p_0 = "B111%" (ftString)][Type: string]
[27.01.2020 17:16:24][Trace][Value: p_1 = "Y" (ftString)][Type: string]


The Query Returns 9 rows. What poblem am I running into?

Thanks for answers!

Does the error happen at first time you run the code?

Because you are leaking memory in that code, you didn't destroy either mgr nor list variables. So if you call it too many times it will indeed take up all your memory.
Also, do you happen to have blobs in that table?
This is a quick and dirty test program (to exercise projections).

Yes, this happens on the first run. And yes, there are blobs in the table, maybe 4 or 5.
And the problem seems to be related to opening the Aureliusdataset or the FMXLiveGrid, maybe. If I just output the rows to a memo: no memory problem.
Maybe the problem is the number of columns to be auto-generated within the FMXLiveGrid?

I don't know, I think we can only be sure by debugging the application.

What are the size of the blobs?
Have you tried setting the blobs as lazy?
Outputting to memo works, but what about the blobs? Can you use a different db component that still shows the blobs?

I think the problem here was the number of columns and blobs, which in turn forced the FMXLiveGrid to create the approriate columns. Nothing that would be needed in real.



No memory issue here. :- )