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.
SDAC and memory usage
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:
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.
However, the VirtualTable.AssignDataSet method is extremely slow, because of the following code:
Code: Select all
SourceField := Source.FieldByName(Fields[i].FieldName);
-
- Devart Team
- Posts: 925
- Joined: Thu 17 Nov 2005 10:53