?
Solved

EDBEngineError: Insufficient memory for this operation.

Posted on 1997-05-19
6
Medium Priority
?
1,686 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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 200 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

762 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