Another core service provided by the runtime’s execution engine is garbage collection. Historically, memory management has been a painful business for developers. Often, error-prone code results, and even the simplest code gets bloated by low-level bookkeeping code. On top of that, direct pointer manipulation isn’t exactly appropriate in a world where memory safety and type safety are to be maintained.
Previous approaches to memory management were either too low-level (such as
free in C and
delete in C++), causing bugs such as dangling pointers and double frees, or reached their limits if things got too complex (such as the inability to reclaim cyclic references in the world of COM’s
Release reference ...