This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Unloading classes


On 3 Nov 2002, Anthony Green wrote:
> On Sun, 2002-11-03 at 17:16, Jeff Sturm wrote:
> > Also, a classloader must keep strong references to its loaded classes.
>
> Why is that?

It's the simplest way to satisfy the condition that a class cannot be
unloaded while its classloader is reachable, as described in JLS 12.7:

"Since we can never guarantee that unloading a class or interface whose
loader is potentially reachable will not cause reloading, and reloading is
never transparent, but unloading must be transparent, it follows that one
must not unload a class or interface while its loader is potentially
reachable. A similar line of reasoning can be used to deduce that classes
and interfaces loaded by the bootstrap loader can never be unloaded."

> Another interesting question is how to handle System.loadLibrary().  Can
> we dlclose() them when the class calling System.loadLibrary is
> finalized?

I think you need to guarantee no static method of the class is executing
when you dlclose().  This is hard with the current GC.

Jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]