Solved

EDBEngineError: Insufficient memory for this operation.

Posted on 1997-05-19
6
1,590 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

746 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