Bill Pugh wrote:
> But we couldn't absolutely convince ourselves that running a static method
> of a class ensures the class is reachable.
> (By the way, section 12.7 of the JLS (2nd edition) says "A class or
> interface may
> be unloaded if and only if its defining class loader may be reclaimed
> by the
> garbage collector as discussed in §12.6." But it isn't discussed there.
I assume that comment refers to the reclamation of objects in general,
not just class loaders. In particular (start of 12.6.1) "A reachable
object is any object that can be accessed in any potential continuing
computation from any live thread."
In the case quoted if both the class of class loader can't be reached
(through class constants, the Method, security managers, exceptions, the
thread, etc), as there's no finalizers, the objects are reclaimable. It
would be a bit freaky though.
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel
This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:01:07 EDT