From: Mark Wielaard <mark@klomp.org>
To: Andrew Haley <aph@redhat.com>
Cc: "Sylvain Marié" <sylvainmarie2@yahoo.fr>, java@gcc.gnu.org
Subject: Re: [GCJ-core] dynamically unloading native libraries
Date: Sun, 02 Nov 2008 17:43:00 -0000 [thread overview]
Message-ID: <1225647792.13437.6.camel@dijkstra.wildebeest.org> (raw)
In-Reply-To: <48EB5915.4050501@redhat.com>
Hi,
Responding to a pretty old email that I only saw just now for some
reason.
On Tue, 2008-10-07 at 13:41 +0100, Andrew Haley wrote:
> Sylvain Marié wrote:
> > I am working on a project involving GCJ on an embedded Linux busybox.
> > We are particularly fond of the ability of GCJ to use java in "compiled mode".
> >
> > In order to be able to use both native code (.so), compiled java (.so) and bytecode java
> > (.jar, .class) together with a module loading system, we are running some tests to validate
> > that dynamic code loading/unloading works fine.
> >
> > Strangely enough this does not work on GCJ, whereas it works fine on sun's jvm (a native
> > library is fully unloaded once its classloader is garbaged out).
> >
> > see also :
> >> openJDK, in jdk/src/share/classes/java/lang/ClassLoader.java: finalize method unloads native libraries
> >
> > Is this feature planned to be inetgrated in next versions of the runtime ?
>
> No. While this could be done, it would be quite tricky.
>
> The core problem is that pointers to code (e.g. return addresses in
> the stack) aren't recognized by the garbage collector as pointers to
> the corresponding classes. You'd have to teach the collector to
> convert code addresses to classes, and then garbage collect the
> classes.
But couldn't/shouldn't we do it for JNI native code that was loaded
through the ClassLoader when that ClassLoader is garbage collected?
I believe that is what Sylvain is testing?
We seem to never even call JNI_OnUnload on the jni libraries. Which
seems to suggest we never ever try to unload them even when they are no
longer needed.
Cheers,
Mark
next prev parent reply other threads:[~2008-11-02 17:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-07 12:29 Sylvain Marié
2008-10-07 12:42 ` Andrew Haley
2008-11-02 17:43 ` Mark Wielaard [this message]
2008-11-03 10:46 ` Andrew Haley
2008-11-05 10:45 Sylvain Marié
2008-11-05 11:08 ` Andrew Haley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1225647792.13437.6.camel@dijkstra.wildebeest.org \
--to=mark@klomp.org \
--cc=aph@redhat.com \
--cc=java@gcc.gnu.org \
--cc=sylvainmarie2@yahoo.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).