Common Language Runtime(CLR) in .NET

 

CLR is an execution engine of .NET's framework where all .NET applications runs under the supervision of CLR. CLR guarantees security, automatic memory management and run time error handling to our applications. 

The main functionalities of CLR are 

·         Security Manager 

·         Class Loader 

·         JIT Compiler(Just In-Time Compiler) 

·         Garbage Collector 

·         Exception Manager 

Security Manager: This is responsible for taking care of security of our applications. 

Class Loader: It is responsible for loading the required libraries for execution of the applications from base Class Libraries(CL). 

JIT Compiler: It is responsible for converting IL code into machine code adopting a process known as conversion gradually during the programs execution.

              

 

Garbage Collector: This is responsible for performing memory management which is a process of allocation and de-allocation of memory that is required for a program. Generally memory management of two types, Manual or Explicit memory management and Automatic or Implicit memory management. Allocation and De-allocation of the memory i.e. required for a program whereas in the second case, garbage collector is responsible for allocation and de allocation of memory that is required for the program.

Garbage Collector allocates the memory for objects in a program when and where they are required and de allocates the memory when the objects became unused i.e.,  no longer in access.

 

Exception Handling: It is responsible for taking care of the runtime errors that occurs in a program. Like Java, we have try-catch block and in catch block .Net will throw the Exceptions.