There was a comment in the question calling-system-gc-explicitly stating that "You can not "force" a generic JVM to do garbage collection because a garbage collector is not actually required by the JVM spec.". My question is if there's such a JVM (and how and where does it get used, if so).
Asked
Active
Viewed 286 times
2 Answers
3
Garbage collection (if you ignore weak and soft references) is roughly a simulation of having infinite memory, at least for objects that are unreachable. If an object gets garbage collected in the woods and no code can reach it, did it make a sound?
In practice, JVMs without collectors would be few and far between because in practice memory is limited. About the only places I can think of where a JVM without a GC would be useful would be a research/learning JVM, or a JVM used only for very short-lived processes (where you know you'll destroy the entire JVM before it consumes too much memory).

Laurence Gonsalves
- 137,896
- 35
- 246
- 299