I'm publishing this entry to help some poor developer someday who gets a "System.OutOfMemory" error in .Net.
I kept getting mine when I tried to fill a data table with a large set of records. Around 1.9 million rows to be precise.
I looked around at a lot of articles and threads, but this one helped me the most:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=878282&SiteID=1
Although it's a little technical the thing that helped me the most was setting the MinimumCapacity on the data table that was receiving the data from the SQL Server.
You can do this by a simple select of the count of the table if you know it or at least make an educated guess. Because DataTable memory space is allocated contiguously, errors occur when you exceed it's initial size by a lot.
No comments:
Post a Comment