Discussion:
Possible memory leak
(too old to reply)
Simon Owen
2006-12-17 10:01:52 UTC
Permalink
Hello,

I'm using IBX within BDS 2006 and have come across a rather strnage memroy
error which I can reproduce with the simple piece of code:

IBQuery1->Active = true;
while( !IBQuery1->Eof )
IBQuery1->Next();

The SQL for the query simply fetches all records from a table (about
10,000), the records themselves have quite large VARCHAR fields. When run,
the memory use of the program grows quickly until an exception "Out of
Memory" is thrown. Strangely, when I changed the components over to use
DBExpress versions, no such error occurs at all.

Was wondering if anyone else had had any problems with the IBX components in
BDS 2006. This is a bit of a show stopper for me, as I have a rather large
application thtat relies on IBX, which I daren't port from BCB5.

Thanks in advance for any help,

Simon Owen
Wayne Niddery [TeamB]
2006-12-17 16:46:37 UTC
Permalink
Post by Simon Owen
I'm using IBX within BDS 2006 and have come across a rather strnage
IBQuery1->Active = true;
while( !IBQuery1->Eof )
IBQuery1->Next();
The SQL for the query simply fetches all records from a table (about
10,000), the records themselves have quite large VARCHAR fields. When
run, the memory use of the program grows quickly until an exception
"Out of Memory" is thrown. Strangely, when I changed the components
over to use DBExpress versions, no such error occurs at all.
That's because, by defauly, dbExpress components do no caching of the
records fetched, each time you fetch the next record, the prior one is
forgotten. By default, TIBQuery *caches* every record you fetch, so you end
up with all 10000 large records in memory. To change this, set the
UniDirectional property of the TIBQuery to True. Better yet, if you only
need to process these records in code - no dataware controls, then don't use
TIBQuery, use TIBSQL instead - it is a much simpler component (no ability to
cache) and is perfect for this kind of use.
--
Wayne Niddery - Winwright, Inc (www.winwright.ca)
Working for yourself is great because you get to work half days, and
you can choose any twelve hours you want.
Loading...