I have a question. As far as I know in .net out of memory exception can be raised in the following 3 scenarios
- Boxing
- Creating an Array
- Creating an Object
Normally it's raised when the managed heap is fragmented or does not have enough space to hold the object. My question if there is insufficient managed heap then where is the OutOfMemoryException object is created? Isn't it created on the managed heap? How does .Net framework makes sure that there is always enough space on the heap to create that OutOfMemoryException object?
Please help. I might be misunderstanding something.