Managed vs. Unmanaged Code

Definition and Differences

Feature Managed Code Unmanaged Code
Memory Management Handled by CLR (Garbage Collection) Developer must manage manually
Security Built-in security checks More vulnerable to memory leaks and attacks
Execution Runs within .NET environment Runs directly on OS
Language Examples C#, VB.NET C, C++, Assembly

How the .NET Runtime Manages Memory and Execution

  1. Memory Allocation
  2. Garbage Collection (GC)
  3. Just-In-Time (JIT) Compilation
  4. Exception Handling
  5. Security and Type Safety

Examples of Managed and Unmanaged Code


.NET Assemblies

Definition of Assemblies