This is the mail archive of the java-discuss@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: globalizing java object references


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]