Jump to content
limelect

Out Of memory

Recommended Posts

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 by limelect

Share this post


Link to post

 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

@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

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

@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 by limelect

Share this post


Link to post

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.

  • Like 1

Share this post


Link to post

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×