Thursday, February 16, 2012

asp.net worker process runs out of memory when using a large dataset

Hi,

I'm running an application on a server which grabs data from a database table on another server using SqlConnection, SqlDataAdapter and DataSet.

The application then updates every row in that DataSet's DataTable and the updates are saved back using DataAdapter. The code is pretty much straightforward code that you would find on MSDN documentation for using DataSets. The table contains a little over a million rows.

When I run the application, I get an error saying the Server Application is not available. Upon looking into the application event log, I get this message.

aspnet_wp.exe was recycled because memory consumption exceeded the
306 MB (60 percent of available RAM)

How do I get round this? I thought DataSets were supposed to handle large datatables comfortably without having memory issues.

-Thanks

They can, just increase your recycle point. Although with a million rows, it's likely you grind that little box into the ground. Buy more RAM, or expect to wait forever for a response. Using a DataReader instead of a dataset is what will allow your little box to access large tables without consuming a ton of memory.

No comments:

Post a Comment