This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
JNI: marking and unmarking global and local references
- To: java at gcc dot gnu dot org
- Subject: JNI: marking and unmarking global and local references
- From: mgd at swarm dot org (Marcus G. Daniels)
- Date: 25 Mar 2001 17:42:13 -0800
JNI says that local and global references are different categories,
but the mark_for_gc and unmark_for_gc conflate them. For example, the
GCJ libjava runtime will undo the intent of the NewGlobalRef below
(create a unique handle to a preserved global object), since gref and
lref end up having the same value.
jobject lref = (*env)->GetObjectClass (env, obj);
jobject gref = (*env)->NewGlobalRef (env, lref);
(*env)->DeleteLocalRef (env, lref)