All Your Base Are Belong To Us

Mostly .NET internals and other kinds of gory details

New Silverlight SOS.DLL Command: !AnalyzeOOM

In the conclusion of my previous post on the Silverlight SOS.DLL, I’ve mentioned that some new commands (not present in the desktop CLR version) have been added.

The first command we’ll talk about is !AnalyzeOOM, which (as its name implies) analyzes an out of memory condition and explains what went wrong.  There are various reasons for out of memory exceptions, and this command can help you to pinpoint exactly what went wrong.

I’ve written a simple Silverlight application that allocates 1MB byte arrays in a loop and keeps them referenced forever.  After a few seconds the application crashes with an OutOfMemoryException.  Running the command exposes the following:

0:005> !PrintException
Exception object: 03991ad4
Exception type: System.OutOfMemoryException
<snipped for clarity>
0:005> !AnalyzeOOM
Managed OOM occured after GC #17 (Requested to allocate 1048592 bytes)
Reason: Didn't have enough memory to commit

Observing the process’ virtual address space reveals the following (edited):

0:005> !VMStat
TYPE  MINIMUM MAXIMUM AVERAGE
Free:
Large 1,032K  16,004K 5,898K
<snipped for clarity>

Hmm.  The largest available block of virtual memory is less than 16MB (which is less than the smallest GC segment size).  This is why the allocation is failing.

Comments

All Your Base Are Belong To Us said:

Another SOS.DLL command new in Silverlight is !HeapStat , featuring statistics on the sizes and available

# August 27, 2008 6:01 AM

Ilya Ryzhenkov said:

Any chance to have these new commands in "normal" sos?

# August 28, 2008 5:00 AM

CAsm said:

The new commands look like they are available in .NET 4.0 (based on beta1 anyway).

# June 4, 2009 3:05 AM
Leave a Comment

(required) 

(required) 

(optional)

(required) 


Enter the numbers above: