globalizing java object references
Tom Tromey
tromey@cygnus.com
Sat Apr 1 00:00:00 GMT 2000
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
More information about the Java
mailing list