Reputation: 17210
I have a C# program that populates a dictionary with 4Million Guids at startup. I keep getting an Exception of type 'System.OutOfMemoryException' error at this point.
Example:
using (reportingconn)
{
var initialrowkeys = reportingconn.Query("select rowkey from table”);
}
Can anyone give me some ideas how best to retrieve large amounts data from SQL into a dictionary?
Upvotes: 1
Views: 1412
Reputation: 17210
It seems like there is a 2GB memory limitation on C# data dictionary. A programmer friend told me to change my console application from 32 bit to 64 bit to prevent that limitaion. That seems to have resolved my problem.
Upvotes: 0
Reputation: 7042
Use SqlDataReader()
this will read row by row, instead of SqlDataAdapter.Fill.
Upvotes: 5