When you see such statement, one thing which comes in your mind about purpose of new keyword is that it creates an instance, isn't it?
Class objC= new Class();
When this is certainly the main purpose, there are other behind the scene tasks our well known new keyword is responsible for, lets understand what:
1- Verifies the size needed for object allocation on managed heap.
2- If sufficient space is available then allocate the object, where application root pointer is pointing.
3- If required space is not available then, it triggers the GC (Garbage collection) lives in System.GC namespace, which does the heap cleanup and then after reclamation of needed space, the object will be allocated.
So, new is not just instance creation, its more that that. By the way, IL instruction for new is newobj.


Jai Prakash VishwakarmaPosted Mar 29, 2013, 6:11 AM EDT
Good one
Vidya Vrat AgarwalPosted Mar 27, 2013, 10:47 PM EDT
Thanks everyone. @Anil, if required space is not reclaimed then .NET will throw "OutOfMemoryException"
Anil KumarPosted Mar 27, 2013, 8:33 PM EDT
What if required space is not reclaimed?, will it return any kind of exception?
kumar Kashyap PandeyPosted Mar 27, 2013, 7:30 AM EDT
Sir, you have elaborate a new dimension to NEW keyword in our.net world, instead on only instance creation. Great and thanks.
Puneet AMaRPosted Mar 25, 2013, 11:55 PM EDT
good one
Jeetendra SharmaPosted Mar 25, 2013, 9:05 AM EDT
Gr8 sir
Vithal WadjeTOP 100Posted Mar 25, 2013, 4:04 AM EDT
great sir,