This is the mail archive of the
java-discuss@sourceware.cygnus.com
mailing list for the Java project.
Re: globalizing java object references
- To: Oskar Liljeblad <osk at hem dot passagen dot se>
- Subject: Re: globalizing java object references
- From: Tom Tromey <tromey at cygnus dot com>
- Date: Fri, 3 Mar 2000 14:26:23 -0800 (PST)
- Cc: java-discuss at sourceware dot cygnus dot com
- References: <20000303231111.A22325@strix.eductussyd.se>
Oskar> Is it possible to circumvent this somehow? Or are there plans
Oskar> to implement this in a near future?
There are ways to circumvent it. For one really ugly way, look in
jni.cc -- we reference count JNI local and global refs.
Having a nice API would be good. I'm afraid it isn't on my to-do
list. But if you want to write something, the patch list is always
open...
Oskar> I'm (still) experimenting with interfacing Gtk in java using
Oskar> CNI. It may be reasonable to store a reference in each
Oskar> GtkObject to the corresponding Java object (if any). (Gtk has
Oskar> convenient functions for doing this,
Oskar> gtk_object_{get,set,remove}_data.) But this would not be
Oskar> possible right now, because the way Java objects are memory
Oskar> managed?
That's true. If the Gtk reference became the only reference to the
object, the GC would think that it had died and would collect it.
Tom