• Sign In
 
  • MSDN Blogs
  • Microsoft Blog Images
  • More ...
Common Tasks
  • Blog Home
  • Email Blog Author
  • RSS for comments
  • RSS for posts
Search
  • Advanced search options...
Tags
  • .NET Framewor
  • .NET Framework
  • Ajax/Javascript
  • ASP.NET
  • CLR
  • Cool stuff
  • DataAccess
  • Debugging/Windbg
  • Hotfix/Service Pack
  • IDEVDataCollector
  • IIS
  • Internet Explorer
  • Italian techs
  • LogParser
  • OT
  • Personal
  • Productivity
  • Random
  • Scripting/ASP
  • Security
  • Technology
  • Tools
  • Troubleshooting
  • Vista/Longhorn
  • Visual Studio
Archives
Archives
  • November 2010 (1)
  • October 2010 (1)
  • July 2010 (2)
  • April 2010 (1)
  • March 2010 (2)
  • February 2010 (2)
  • January 2010 (1)
  • October 2009 (2)
  • September 2009 (2)
  • August 2009 (1)
  • July 2009 (5)
  • June 2009 (1)
  • May 2009 (1)
  • April 2009 (3)
  • March 2009 (3)
  • February 2009 (5)
  • January 2009 (3)
  • December 2008 (5)
  • November 2008 (3)
  • October 2008 (2)
  • September 2008 (3)
  • August 2008 (3)
  • July 2008 (3)
  • June 2008 (5)
  • May 2008 (4)
  • April 2008 (8)
  • March 2008 (4)
  • February 2008 (5)
  • January 2008 (2)
  • December 2007 (4)
  • November 2007 (6)
  • October 2007 (6)
  • September 2007 (8)
  • August 2007 (6)
  • July 2007 (7)
  • June 2007 (10)
  • May 2007 (9)
  • April 2007 (12)
  • March 2007 (8)
  • February 2007 (5)
  • January 2007 (3)
  • December 2006 (1)
  • November 2006 (4)
  • October 2006 (2)
  • September 2006 (9)
  • August 2006 (2)
  • July 2006 (1)

I have an OutOfMemory exception in my dump! Am I leaking memory?

MSDN Blogs > Never doubt thy debugger > I have an OutOfMemory exception in my dump! Am I leaking memory?

I have an OutOfMemory exception in my dump! Am I leaking memory?

Carlo Cardella
4 Aug 2007 4:59 PM
  • Comments 2

Well... the short answer is: not necessarily smile_regular

I had this discussion a few days ago with a customer who called CSS for a crash they were having, and since he was also starting to learn some debugging and dump analysis basics, he was interested to have some deeper details about my findings in the crash dump they sent in.

In particular, he thought the crash was due so an OutOfMemoryException because checking the exceptions with WinDBG, he saw something like the following:

0:000> !dumpallexceptions
Going to dump the .NET Exceptions found in the heap.
Number of exceptions of this type:        1
Exception 0cf500bc in MT 79b94ee4: System.ExecutionEngineException

-----------------

Number of exceptions of this type:        1
Exception 0cf5007c in MT 79b94dac: System.StackOverflowException

-----------------

Number of exceptions of this type:        1
Exception 0cf5003c in MT 79b94c74: System.OutOfMemoryException

-----------------

The point is that we are pre-loading a few exception objects on the heap when starting an AppDomain, and the reason is quite simple if you think about it for a moment. Let's pretend we don't have exception objects preloaded: if an application ever reaches a condition where needs to allocate some more memory but there is not enough memory available, then the CLR will have to throw an OutOfMemoryException; but if there is no more memory available on the system (I'm avoiding some details here, but you get the idea), where can we find the memory needed to allocate a new exception object (and all other objects involved in the background)? smile_thinking

I think you already found the answer: those objects must be already on the heap, thus the CLR is pre-loading them. There is a similar reason behind the ExecutionEnginException and the StackOverflowException objects.

 

Carlo

  • 2 Comments
ASP.NET, Debugging/Windbg
Leave a Comment
  • Please add 8 and 6 and type the answer here:
  • Post
Comments
  • MSDN Blog Postings » I have an OutOfMemory exception in my dump! Am I leaking memory?
    5 Aug 2007 1:25 AM

    PingBack from http://msdnrss.thecoderblogs.com/2007/08/05/i-have-an-outofmemory-exception-in-my-dump-am-i-leaking-memory/

  • Never doubt thy debugger
    27 Apr 2009 1:05 PM

    The application pool for this site was getting disabled quite frequently and we found quite a few entries

Page 1 of 1 (2 items)
  • © 2012 Microsoft Corporation.
  • Terms of Use
  • Trademarks
  • Privacy Statement
  • Report Abuse
  • 5.6.402.223