> From: Christopher Schultz [mailto:ch...@christopherschultz.net] > Subject: Re: tomcat 5.5.25 shared lib and sharing webapp jars > > What about classes with mutable static members? These members should be > preserved for a while, right?
Only while the java.lang.Class instance is reachable; after that, the value of the member is irrelevant. > Does this mean that classic Java singletons are never able to > be GC'd because they have a private static member that points > to an instance of the Class that cannot be cleared? No, GC ignores such circular references. For example, if object A references B, and B references C, and C references A, but none of the objects are strongly reachable via the defined roots, they will all be discarded. The defined roots include all active stack frames, the current operand stack for each executing method, and objects requested via JNI. The circular reference issue is what makes reference counting garbage collectors problematic, but it doesn't affect modern ones. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.