ASP.NET System.OutOfMemoryException
asp.net, memory, out-of-memory
Solution
More common reason to get `System.OutOfMemoryException` is due to memory fragmentation - there is no large enough continuous space in memory. You should install a memory profiler to verify that - then you can also try to find out which objects take up the memory.
If possible, you might want to test .NET 4.5 - Microsoft has made changes to the Garbage Collector so that LOH is automatically defragmented for server applications (such as IIS): http://blogs.msdn.com/b/dotnet/archive/2011/10/04/large-object-heap-improvements-in-net-4-5.aspx
Problem
This is Windows server 2008 R2, 64 bit, 32gb RAM, I think its running IIS 7.5. We have set the application pool to use 4 worker process. This is a ASP.NET 4 application but running in 32 bit compatability mode. We are getting oSystem.OutOfMemoryException when the memory usage crosses more than 650-700MB/worker process. I thought that it should be able to handle upto 2gb or atleast 1.5 gb with no issues? Another thing, why does it not recycle the worker process when there is a System.OutOfMemoryException? update: This application works perfectly fine on a 64bit windows server 2003 with IIS6.0. I have seen the max memory usage of it being around 700mb/worker process. Update: The reason for high memory usage is XML processing using DOM. We are going to start work to fix that, but thats a long term plan. I just find it weird that it cannot go higher than 650 mb.