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.

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.