Page 1 of 1
SDAC and memory usage
Posted: Tue 26 Feb 2008 07:53
by yeohray
I have a SQL Compact database that's around 136 MB in size. I run a query that returns around 190,000 rows using TMSQuery connected to a TMSCompactConnection. Using the Windows Task Manager, I see that my app consumes around 1.2 GB of virtual memory. In some cases, SDAC returns an 'Out of memory' error.
Is this normal? How can I reduce the memory consumption?
Thanks.
Posted: Wed 27 Feb 2008 10:22
by yeohray
Since I didn't need an updateable dataset, I set unidirectional to true, and copied the entire dataset to a VirtualTable. This reduced the memory consumption greatly.
However, the VirtualTable.AssignDataSet method is extremely slow, because of the following code:
Code: Select all
SourceField := Source.FieldByName(Fields[i].FieldName);
The FieldByName method is the bottleneck. Maintaining an array that maps each source column to a target columns results in much better performance. The Assign method took 35 seconds in my app previously. Adding an array to map the columns reduced the time to 5 seconds.
Posted: Wed 27 Feb 2008 12:59
by Challenger
Thank you for your assistance. We will add this optimization in the next build of SDAC.