OutOfMemoryException / ERROR_COMMITMENT_LIMIT with a LOT of free memory in the system

1

I'm running my code on a cluster and I'm seeing a problem that I cannot replicate locally, and do not see the reason for.

So, the program starts spuriously throwing OutOfMemoryException's in random places all over the code.

Moreover, looks like this might have to do with something having broken in Windows itself - one of those exceptions manifested itself as an HRESULT of an Assembly.Load operation, with the HRESULT being 0x800705AF, which, when decoded, means error 1455 ERROR_COMMITMENT_LIMIT (swapfile exhausted).

The program actually consumes a very small amount of memory, it is 32-bit, runs under .NET 4.0.30319, and the server is Windows Server 2008, with 12 cores, 24Gb RAM (almost all of which free) and several dozen gigabytes of free hard drive space on the swap partition.

How can I debug the reason for this error at all? What diagnostic tools to use?

.net
windows
out-of-memory
swap
asked on Stack Overflow Mar 24, 2011 by jkff

2 Answers

2

This is the way a 64-bit process dies on a out-of-memory condition. Be careful at what you look at to diagnose this. It is never RAM that you run out of, it is virtual memory space. You have to look at a number like VM-size or Private Bytes, Task Manager focuses too much on RAM.

A 64-bit process has an enormous virtual memory space, 16 gigabytes and up, depending on what version of Windows you run on. It is impossible to completely use it up, the machine dies a swapping death before you can get close. Which of course the operating system cannot allow to happen, thus ERROR_COMMITMENT_LIMIT. In practice, a 64-bit process is limited by the amount of space it can reserve in the paging file.

Use a tool like SysInternals' Process Explorer to have another look. A memory profiler when you do see virtual memory size growing without bound.

answered on Stack Overflow Mar 24, 2011 by Hans Passant
0

First check if your application is running under 32 or 64 bit mode, look in taskmanager if your applicaiton has *32 in the end it means its running under 32 bit. A 32 bit application has only 2GB of virtual address space for your application. And an OOM happens when OS could not find sufficient contiguous address to fulfil your application memory request. So to identify the issue i would recommend reading the article http://www.codeproject.com/Articles/176031/Out-of-Memory-Exception-A-simple-string-Split-can-.aspx. If the article above does not solve your problem then you may refer http://blogs.msdn.com/b/tess/archive/2008/02/04/net-debugging-demos-information-and-setup-instructions.aspx.

answered on Stack Overflow Apr 7, 2011 by Vipin Kumar

User contributions licensed under CC BY-SA 3.0