the following line is marked as true in #16(exam cram)- The method by which Java determines that a chunk of memory is garbage is up to the implementer of the JVM. I have problems understanding this... the mode of gc is dependant upon the JVM, not determining what is garbage. If there are no references to it, or the references are from an object that itself has no reference( or a circular reference from the former object), that chunk is junk! Thanks to the ambiguities of Englishlanguage, maybe you can somehow contrive another meaning of this, but to me, this is what it means. any comments appreciated, esp. those of Bill.
Who coins the rule: "If there are no references to it, or the references are from an object that itself has no reference( or a circular reference from the former object), that chunk is junk" ? the implementer of JVM, i guess
I am just trying to say the the Java Language Spec does not lay down the law on the exact algorithm to be used to determine that a chunk of memory has no references. Designing the GC mechanism for a particular JVM is left up to the implementor. There is a huge body of Computer Science on GC mechanisms, but you don't have to worry about that. In other words - the criterion for a collectable object is defined but the mechanism for discovering that the criterion is met is up to the implementor. Bill
The Specification says that unreachable objects are eligible for garbage collection. The algorithm which a particular JVM uses to determine that an object is unreachable is up to the designer of the JVM. Creating the algorithm suitable for particular applications - ie browser versus server versus cell phone - is an arcane science. For the exam, you don't have to know anything about the GC algorithm, just what qualifies an object for GC. Bill