| Author : Manoranjan Sahoo|| Member Level : Bronze||Date : 17/09/2014 05:46:11 AM|| Points : 2|
When you compile a .NET language it generates an assembly. This assembly contains the IL instructions. When you run a .NET program, the win32 loader loads the CLR and hands off control to it. The CLR loads the assembly and locates the entry point of the program. The processor can't execute IL so the CLR invokes the JIT compiler to compile the method to machine code. All methods called from entry point(Main) are stubbed out. The machine code is now executed by the processor. When the code path takes it into one of the stub functions, the JIT compiler is re-invoked to compile the new method and it's called methods are stubbed out.
During the execution of the code, objects are created by memory allocation. This memory is allocate on an area of memory called the managed heap. Because this block of memory is not infinite, eventually an allocation will cause a threshold to be breached where the CLR decides memory must be reclaimed. The Garbage Collector is invoked and it walks through the objects that are still potentially in use in the application and marks them as still in use. The memory for every object not marked as in use can then be reclaimed.
Hope this will help you to understand.