Reputation: 686
I found that System.Exception
requires many memory allocation(many String
s, even IDictionary
). What happens when there is no enough memory to construct an OutOfMemoryException
?
After searching, I found a similar question: What happens when there's insufficient memory to throw an OutOfMemoryError? Does CLR behave like that?
Upvotes: 1
Views: 140
Reputation: 2984
As you (Cu2s) mentioned, the framework pre allocate some objects. The OutOfMemory is not the only one. StackOverflow of course is also needed.
See source here
And also this blog post
You can see it yourself in WinDbg or some other tool.
For example when I'm running this code:
static void Main()
{
Console.Read();
}
I see in the heap the following:
Upvotes: 3