limelect 48 Posted August 19, 2022 (edited) My application has an out-of-memory error On the break the source wants FireDAC.DatS.pas which I do not have Any idea how to solve this? if possible P.S after the out of memory if i keep going it is ok The part that does it is ProjectsFDTable.Filtered := false; ProjectsFDTable.FilterOptions := [foCaseInsensitive]; case RadioGroup2.ItemIndex of 0: begin //'%a%' ProjectsFDTable.Filter := {QuotedStr} 'ProjectrealName LIKE ' + QuotedStr('%' + Edit6.Text + '%'); <<< end; 1: begin end; 2: begin ProjectsFDTable.Filter := {QuotedStr} 'Category LIKE ' + QuotedStr('%' + Edit6.Text + '%'); end; end; ProjectsFDTable.Filtered := True; However, I am not sure it is only here !!! but this is where i could trace the out of memory Edited August 19, 2022 by limelect Share this post Link to post
Lajos Juhász 293 Posted August 19, 2022 Most probably you're loading 1.7GB data into the memory (you can verify using task manager). Insted of a client side filter you should do a server side. Share this post Link to post
limelect 48 Posted August 19, 2022 @Lajos Juhász first can you clarufy. second, if you are right once I get the memory msg and I dismis the message I do NOT get any more messages. The memory message is ONLY ONCE !!! Share this post Link to post
Clément 148 Posted August 19, 2022 You're probably hitting 32 bit application address space limit. One easy way to check this is to open Task Manager and monitor you application when executing that specific lines of code. *IF* this is the problem, then you are downloading too much data, and the "Out of memory" will happen in whatever unit asks for memory and don't get it. FireDAC has some Fetching options, and my guess is you're using FetchAll. You might want to try fmOnDemand. " FireDAC is fetching rowsets according to the FetchOptions.Mode property: fmOnDemand--the rowset is automatically fetched when the dataset is trying to move the current position beyond the last fetched record. fmAll--all the rowsets are automatically fetched right after executing the SQL command. This is similar to calling the FetchAll method. fmManual--the programmer manually fetches the rowsets using the FetchNext or FetchAll methods. fmExactRecsMax--all rowsets are automatically fetched right after executing the SQL command. If the number of rows is different from FetchOptions.RecsMax, an exception is raised. " https://docwiki.embarcadero.com/RADStudio/Sydney/en/Fetching_Rows_(FireDAC) You are seeing the message only once most probably because FireDAC exception handler is freeing the memory allowing you application to work with whatever memory is available. HTH Share this post Link to post
limelect 48 Posted August 19, 2022 (edited) @Clément the only thing I see on FDTable is on FetchOption.mode is already fmOnDemand Let me clarify the point. Memory happens ONCE. Then everything is ok. If there was a real memory problem it should have been all the time want it? I am filtering the database upon writing a search text Each char one enter does a new filter. To be exact on >>>> procedure TForm1.Edit6Change(Sender: TObject); (my database file 1.55GB) Edited August 19, 2022 by limelect Share this post Link to post
Hans J. Ellingsgaard 21 Posted August 19, 2022 The table component is not well suited for large datasets. It's better to use a query, and do the filtering with sql. Share this post Link to post
Lajos Juhász 293 Posted August 20, 2022 In this case Fetchoptions doesn't make a difference. in order to do a client side filter the computer has to load all the data and then can filter out the requested records. 1 Share this post Link to post
limelect 48 Posted August 26, 2022 Thanks, guys I hope it is fixed I changed my table to Fetchoptions all i hop it fixed it and the search is faster Share this post Link to post