OracleDataset allocates really too much memory

mmartinic

Member²
Dear Allround-Team,

I have "small" problem with TOracleDataSet components - it takes approx. 200Mb of RAM
for running one simple SQL against Oracle 10g database, which retrieves 4000 records only.

I have modified and tested the same application
using ADO components, and the diference is really big - with ADO components for the same SQL, the application needs only 35Mb of RAM.

What can be the problem?
Is it possible that DOA komponents (or maybe only TOracleDataSet) have a memory leaks?

Urgently need a solution!

Thanks,
Mickey Martinic

Environment:
- MS Windows XP Pro SP2
- Borland Delphi 2005 SP3
- DOA 4.0.7.1
- Oracle 10g v10.1.0.3
 
Hi Jens, Hi Daniel,

I was too busy yesterday, changing our application, so I didn't check this forum.

The Oracle table has approx. 20Kb record size (counting all fields, not only Varchar2) - among others, 2 Varchar2(4000) fields and one Varchar2(1000) field - that's all.

The table self has now, let say, 5000 records in my local DB. Total memory size, when all 5000 records are completelly filled, should be 5000x20Kb = approx. 100Mb. Application self needs 20Mb, so the calculation is very simple -> it shouldn't oversize 120Mb of RAM. The problem is -> it takes 200-230Mb!

Anyway, I didn't have any other choice yesterday, so I bought ODAC Oracle components (currently version 5.55.1.26) for some 100
 
For large result sets that require TOracleDataSet functionality I can only recommend the UniDirectional property. This way memory overhead is minimized, but the restriction is that you can not move back in the dataset.

Using the TOracleQuery component is also a good method to minimize overhead.
 
You can't. You will need a TOracleDataSet for this. The only way to minimize memory overhead for TDataSet functionality is to use the UniDirectional property, or to limit the result set to just the records you need.
 
Marco,
could you please describe HOW to use the unidirectional property? We have the same problem, and this is very urgent. If readbuffer = 1000, and you need to retrieve e.g. 100 000 totally, how do you know when to retrieve the next batch after the first 1000 records have been processed? Testing EOF cannot be used, since this is always true in this case.

With regards,
Helene
 
Just set it TOracleDataSet.UniDirectional to True and don't use TOracleDataSet.Prior or TOracleDataSet.First. The Eof property does not behave differently, and will be True when moving beyond the last record.

The ReadBuffer property does not affect behavior either, and is merely a network roundtrip tuning property.
 
Hi Marko.

There is problem with Unidirectional property. If DS is unidirectional, it is not possible connect it to DBGrid!
Is there another way, how solve this large memory usage? For many situation be enought solution for ReadOnly dataset ...

Sorry my poor english ..
 
Generally unidirtional Datasets can't be connected to a Grid. That isn't a limitation of DOA. Grids doesn't cache data so the dataset must be bidirectional to move forward and backward.
 
Try to use a TClientDataset connected to a unidirectional TOracleDataset - but I don't know if cds memory manager is really better...
 
Back
Top