Click here to Skip to main content
15,889,862 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
I have a text file with the 3000000 records. After reading these records I am trying to fill these data into the Data Table. And after that I am getting System.OutOfMemoryException error message.
Can anybody give me a solution for this problem.
Posted

1 solution

You should convert your application into reading and processing the data in batches (chunks of data). For example, process 20000 records of the file, and then the next 20000, etc.

Reading all these records at once in to a DataTable is never a good idea and can almost always be converted to an other solution that does not need to read all the records at once.

Hope this helps.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900