This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: [GCJ-core] dynamically unloading native libraries
- From: Andrew Haley <aph at redhat dot com>
- To: Sylvain Marié <sylvainmarie2 at yahoo dot fr>
- Cc: java at gcc dot gnu dot org, mark at klomp dot org
- Date: Wed, 05 Nov 2008 11:07:39 +0000
- Subject: Re: [GCJ-core] dynamically unloading native libraries
- References: <486895.21159.qm@web28503.mail.ukl.yahoo.com>
Sylvain Marié wrote:
> Thank you for putting the topic back on the table,
>
>> We seem to never even call JNI_OnUnload on the jni libraries.
>
> That's exactly my point - and also even libraries that do not contain JNI at all
> (simple .so without any relation to java - I know it is not a very useful case but it is
> very simple to test with a dummy .so).
>
> But the root cause of the problem is a bit more complex:
>
> a) As you mentioned, ClassLoaders don't unload unused native libraries when they are finalized.
>
> but also
>
> b) ClassLoaders don't even seem to be finalized when they are not used any more.
> (no alive instances, etc.)
>
> So even correcting a) would not help, we should first try to understand why
> ClassLoaders are never gc'ed.
Yes. I can't think of any immediate reason why they aren't: it's a matter
worth investigating.
Andrew.