Page 1 of 1

Excessive memory usage

Posted: Fri 18 Mar 2011 09:48
by sandy771
Why does the following code use about 800MB of memory during execution (table with 500K rows). The uderlying database is sqlite

TUniQuery *SearchQuery;
SearchQuery->SQL->Clear();
SearchQuery->SQL->Add("select * from rtable");
SearchQuery->Execute();

do
{
Application->ProcessMessages();
SearchQuery->Next();
}while(!SearchQuery->Eof);

delete SearchQuery;

nb The memory is released when the loop is exited

Thanks

Posted: Fri 18 Mar 2011 11:18
by AlexP
Hello,

The amount of memory used depends on many factors such as: size of data, number of rows, data type, etc.. So if the size of your table is 800Mb, and you are getting all records from it, then this requires 800Mb in memory.

To reduce memory usage, you can set the OraQuery->UniDirectional property to true.