Additional
dbCAP
AnyDAC
ThinDAC
NCOCI8
Topic: Memoryproblem with NCOCI8 1.0.2
Memoryproblem with NCOCI8 1.0.2
Posted: 2004/04/19 07:30
 
Hi,

I'm using this great oracle component-set within delphi 6 (sp2) to transfer data from an oracle database to another target. I've run into a strange behaviour:

The following code is used to do the transfer. The adressed table has something round about 3,000,000 records. ociQDef is of type TOCIQuery

while not ociQDef.Eof do
begin
// Insert the values into another target. Commented out for testing, so there's only reading..

Inc(rcount);
if (rcount Mod 1000)=0 then Write2Screen('.');
if (rcount Mod 100000)=0 then Write2Log('Fortschritt: '+IntToStr(rcount)+
' Datensätze. '+DateTimeToStr(Now));
ociQDef.Next;
end;

This loop just eats up the memory!? Looking at the process monitor I see a steady increase of the allocated memory by the application. After 2,000,000 records, the allocated memory for the application is at 180MB, beginning at 11MB at startup after initialization. Than it will raise an exception, since there's no more memory available.

Does anybody has any idea why this happens or has a workaround for me?
Thanks in advance!

Regards,
Mark.
RE: Memoryproblem with NCOCI8 1.0.2
Posted: 2004/04/21 16:40
 
It's simple!
You read all 3000000 records into your local memory.
If you want to go through dataset just one time from first record to last, you shoud set TOCIDataSet.Unidirectional:=True
Your loop will not eat memery, but you wan't be able to do TOCIDataSet.First, Prior etc.
RE: Memoryproblem with NCOCI8 1.0.2
Posted: 2004/04/22 09:13
 
Hey, thanks, it works!!! :o))
This solves my current problem.

But it's still interesting to me. Is there a way to flush the buffer cache? Why does the component keep every read record in the memory?
For interactive apps it won't be a problem. But if you are writing background tasks that normaly run 24 hours 7 days a week and they have to move forth and back through the dataset, it will end up in a mess...
(no current project with this, but it might come up in the next month...)

Regards,
Mark.
RE: Memoryproblem with NCOCI8 1.0.2
Posted: 2004/04/22 16:03
 
Oracle doesn't provide us with methods to go backward through cursor. Only forward. That's why application have to cache dataset in local memory to be able to scroll in both directions.