5

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.

3
  • 32bit process on 64bit OS can address up to 4Gb of memory. Commented Feb 19, 2013 at 16:58
  • @Knaģis: This is windows-specific. On Linux with the bigmem kernel and a i686+ processor, it can address up to 64 GB of memory. Commented Feb 20, 2013 at 6:42
  • Maybe problem Garbage Collector and ASP.NET 4.5 Commented Oct 30, 2015 at 17:04

3 Answers 3

4

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

Sign up to request clarification or add additional context in comments.

6 Comments

the server itself has 32gb ram, and I have never seen it consume more than 6gb. So not sure why the memory would be fragmented?
Your managed process heap is fragmented, not the server memory. Just assume that .NET VM will allocate 2Gb large block and work within it...
this is a tough one, I cant think of how I am going to take care of memory fragmentation, in a managed application. That is done by garbage collection, right?
You have to identify what objects are the ones that are taking up the memory. Most probably those are some that reside in Large Object Heap (>85kb, since those are never moved to defragment). You might find some that you can clean up earlier in the process, reuse (create a pool etc.) or you might be forced to manually call GC.Collect at some point in your application (GC collects large objects much less often than small ones).
Also you might test if installing .NET 4.5 helps to mitigate the problem since there have been changes in GC related to this: blogs.msdn.com/b/dotnet/archive/2011/10/04/…
|
2

Have you configured your server to handle server garbage collection properly? For asp 4.5 the setting is under the runtime node in the Aspnet.config file

<performanceScenario value="HighDensityWebHosting">

1 Comment

Good patterns and practices about performanceScenario asp.net/aspnet/overview/aspnet-and-visual-studio-2012/… ? News in APS.NET 4.5, yeah. I'm newbie and confused about good patterns and practices using performanceScenario in ASP.NET 4.5, my website I think is slow.
1

Did you check the max. allocated memory, and not just the currently allocated memory when you looked into taskmanager ?

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

A common cause for such an exception would be a large DataTable displayed in a unpaged datagrid.

2 Comments

I dont see any option where I can look up the max allocated memory to a process in TaskManager, anybody?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.