Further, each instance holds a reference to its class. Along with the fact that each class references its loader and that the<br>loader references all the classes it loaded, we have a strongly connected component in the object graph whose lifetime<br>
is the same. So, GC will collect the classloader and its classes when the classloader and all its classes become unreferenced.<br>i.e. when there are no reachable instances of any of those classes, no references to the classloader and no reference to<br>
any of the classes.<br><br>-- ramki<br><br><div class="gmail_quote">On Fri, Jun 8, 2012 at 7:34 AM, Ion Ionascu <span dir="ltr"><<a href="mailto:ionionascu@gmail.com" target="_blank">ionionascu@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br><br><br>Could you please explain how the option ClassUnloading actually works? I found it being mentioned on the internet, but I haven't been able to find too much documentation about it.<br>
<br>In fact I am curious how class-unloading works from JVM/GC's point of view. I am asking this because as far I can see the ClassLoader class has a private property <i>classes</i> which stores a reference to each loaded class so a class should not be unloaded (garbage collected) without its classloader being gc-ed first. So, a property like ClassUnloading should only allow the unloading of classes which are no longer referenced by their classloader.<br>
<br><br>Thank you,<br>Ion Ionascu<br><br><a href="http://www.ionionascu.eu" target="_blank">www.ionionascu.eu</a><br>
</blockquote></div><br>