public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew Haley <aph@redhat.com>
To: "Sylvain Marié" <sylvainmarie2@yahoo.fr>
Cc: java@gcc.gnu.org
Subject: Re: [GCJ-core] dynamically unloading native libraries
Date: Tue, 07 Oct 2008 12:42:00 -0000	[thread overview]
Message-ID: <48EB5915.4050501@redhat.com> (raw)
In-Reply-To: <590931.68795.qm@web25908.mail.ukl.yahoo.com>

Sylvain Marié wrote:
> Hi all,
> 
> 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.

Andrew.

  reply	other threads:[~2008-10-07 12:42 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 [this message]
2008-11-02 17:43   ` Mark Wielaard
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=48EB5915.4050501@redhat.com \
    --to=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).