Solved

EDBEngineError: Insufficient memory for this operation.

Posted on 1997-05-19
6
1,611 Views
Last Modified: 2012-06-21
I have a report from a Beta test system (running my D2 app) with the above exception. I am stumped. This only happens about once a day.
The procedure in my code where this occured, does nothing special. It does the following operations on a Paradox table:

with myTable do
begin
      IndexFieldnames := 'Dati';
      Filter := sMyFilter;
      Filtered := True;
      if FindFirst then
            if (Fields[1].Value > tMyDati) then
                  Result := False
            else
            begin
                  GetThisRecord;
                  Delete;
                  Result := True;
            end
      else
            Result := False;
      Filtered := False;
      Filter := '';
end;

This piece of code gets called repeatedly.

Am I running out of heap or stack or what is going on here?

How do I get the DB unit to compile with debug info on so that I can find the exact location of this exception?

0
Comment
Question by:abeldup
  • 3
  • 2
6 Comments
 
LVL 2

Expert Comment

by:icampbe1
ID: 1336459
You dont say if you have an OnFilterRecord event and if so, what it looks like.  I believe if you move/copy the BD source unit locally, it will compile with your code.  I get confused with this sometimes.  You might have to put a path to it in your project|directories options.  
0
 

Author Comment

by:abeldup
ID: 1336460
No, there is no OnFilterRecordEvent.

This piece of code gets called repeatedly in a TTimer event. The application gets re-started every night at 23:00 and crashes at approx. 10:30 the next morning.

Could this be a memory leak problem? I have searched the Borland BDE site and all I could come up with is that this error falls in the 'Resource or Limit Error' category.

TIA

0
 
LVL 2

Expert Comment

by:icampbe1
ID: 1336461
I know you are showing me pseudo code, but just to be sure, when you say 'FindFirst', do you mean FindFirst as in the directory search FindFirst/FindNext??  Or do you mean a DB FindFirst in your Dataset?   If it is the former, do you have a FindClose at the end??   This is just a long shot.

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:abeldup
ID: 1336462
No, you're on the wrong track there. I am using the TTable's FindFirst.
I have since trapped the exception and this is what the call stack looked like:

DbiError
Check
TDataSet.CreateExprFilter
TDataSet.SetFilterData
TDataSet.SetFilterText
mysubroutine
TTimerEvent

Stepping through the code in the DB unit, I have seen that a filter parsing object is created everytime.

I seem to remember seeing a posting somewhere on memory leaks when using filters on TTable.
0
 
LVL 5

Accepted Solution

by:
ronit051397 earned 100 total points
ID: 1336463
probably by calling 'GetThisRecord' you created a bookmark, therefore, allocated memory for this bookmark and didn't free it.
note, every time you use 'GetBookmark' method you allocate memory. if you dont free it you'll get lots of unnecessary bookmarks. After you use 'GoToBookmark' you should free it this way:
Table1.FreeBookmark(BookMark);
BookMark:=nil;
0
 

Author Comment

by:abeldup
ID: 1336464
No, I do not use bookmarks in my subroutine GetThisRecord. Good tip though.
I have since determined that the leak was caused by the BDE creating a new filter parsing object everytime and not releasing it. I was able to avoid this leak by changing the code to:

with myTable do
begin
    IndexFieldnames := 'Dati';
    Filtered := True;
    Filter := sMyFilter;
    if FindFirst then
        if (Fields[1].Value > tMyDati) then
            Result := False
        else
        begin
            GetThisRecord;
            Delete;
            Result := True;
        end
        else
            Result := False;
    Filter := '';
    Filtered := False;
end;

So by swopping those lines the problem was fixed!

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
automatically logging in via bde delphi 3 70
Delphi procedure  - Unsatisfied forward or external declaration. 2 142
Working with hours 3 46
Performance of SQL statement 37 100
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now