This page should explain different techniques of Memory management in programming languages.
Manual memory management
editE.g. malloc()
and free()
in C.
Cons:
- No protection of memory leaks
- No protection of use after free bugs
Tracing garbage collection
editUsed by:
- Java
- JavaScript
- Common Language Runtime
- Go
- many more
Cons:
- Runtime costs
Reference counting with tracing garbage collection
editThe tracing part is needed for cycle detection.
Used by:
Cons:
- Runtime costs
Reference counting with ownership
editUsed by:
Cons:
- Runtime costs