3 ms·
>You might as well classify allocating without freeing as a form of garbage collection. Of course, Java even explicitly supports this garbage collection strate
by Kranar 5y ago
>You might as well classify allocating without freeing as a form of garbage collection.
Of course, Java even explicitly supports this garbage collection strategy:
https://openjdk.java.net/jeps/318 https://openjdk.java.net/jeps/318
The best definition I've read comes from Raymond Chen, which is that garbage collection is a system to simulate an infinite amount of memory:
https://devblogs.microsoft.com/oldnewthing/20100809-00/?p=13203 https://devblogs.microsoft.com/oldnewthing/20100809-00/?p=13...
This definition is very elegant in that it allows one to reason about program correctness across all garbage collectors without having to know any of the implementation details, be it reference counting or the many flavors of mark and sweep. Basically garbage collection is not an implementation detail, nor is it a specific algorithm or even class of algorithms, garbage collection is a goal, namely the goal of achieving an infinite amount of memory. Different algorithms will reach that goal to different degrees and with different trade-offs.