Is there a JVM lacking garbage collector?
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 开发者_如何学Cused, if so).
For instance, JavaCard's JVM lacked garbage collection until v3.
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).
精彩评论