Excessive memory usage

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
sandy771
Posts: 194
Joined: Tue 22 May 2007 13:57

Excessive memory usage

Post by sandy771 » Fri 18 Mar 2011 09:48

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

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Fri 18 Mar 2011 11:18

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.

Post Reply