Manual Memory management in C
malloc()
⇒ allocates the memory
free()
⇒ frees up the memory
Automatic memory management
- Reference counting ↳ Can’t deal with Cycles ↳ Can lead to memory leaks
Garbage Collection
- Mark
- Reachability check
- Sweep unreachable memory