ASP.NET System.OutOfMemoryException

This is a Windows 2008 R2 server, 64 bit, 32GB RAM, I think its running IIS 7.5. We have set up an application pool to use 4 worker processes.

This is an ASP.NET 4 application, but runs in 32-bit compatibility mode.

We are getting oSystem.OutOfMemoryException when memory usage crosses over 650-700MB / worker process.

I thought it should be able to handle up to 2GB, or at least 1.5GB without issue?

Another thing is why it doesn't recycle the workflow when a System.OutOfMemoryException is thrown?

update: This application works fine on Windows 2003 64 bit server with IIS6.0. I saw the max memory usage was around 700mb / workflow.

Update: The reason for using high memory is XML processing using DOM. We're going to get to work to fix this, but this is a long term plan. It just seems strange to me that it cannot exceed 650 MB.

+3


source to share


3 answers


The more common reason to get System.OutOfMemoryException

is related to memory fragmentation - there is not a large enough contiguous space in memory . You must install a memory profiler to verify this - then you can also try to figure out which objects are taking up memory.



If possible, you can test .NET 4.5 - Microsoft made changes to the garbage collector so that LOH is automatically defragmented for server-side applications (like IIS): http://blogs.msdn.com/b/dotnet/archive/2011/10/ 04 / large-object-heap-improvements-in-net-4-5.aspx

+4


source


Have you configured your server to handle the garbage collector correctly? For asp 4.5, this setting is under the node version in the Aspnet.config file



<performanceScenario value="HighDensityWebHosting">

      

+2


source


You have checked the max. allocated memory, not just currently allocated memory when viewed in taskmanager?

Because the max. allocated memory is the memory that ACTUALLY reserves and therefore uses.

A common cause of this exception would be a large DataTable being displayed in an unmanaged datagrid.

+1


source







All Articles