Solved

EDBEngineError: Insufficient memory for this operation.

Posted on 1997-05-19
6
1,634 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

765 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