More from inside the big house....  
 
Answer from the super-smart guy that wrote the GC:
 
No, you don't need those lines. new xxx(....) will either return an instance or throw OOM for you.
-----Original Message-----
Sent: Mon 5/12/2003 10:37 AM
Subject: Should API check and throw OutOfMemoryException?

Hi, everyone,

My understanding is that: OutOfMemoryException is thrown by .NET runtime when new request cannot be satisfied. My API cannot catch this exception and continues. Instead, this exception will manifest itself to the end user.

 

Is my understanding correct? To be clear, do we need this kind of code?

 

m_Canvas = new MyCanvas;

//Do We Need The Next Three-Line Code??

if (m_canvas == null)

{

            Throw (new OutOfMemoryException());  

}