GC and Objects not used

Ivana Visconti iviscont at dcc.uchile.cl
Sat Oct 16 13:00:59 PDT 1999


Hi all,

I am working with the GC and I need a little help, maybe someone can
help me.
I have the following code:

//////////////////////////////////////////////
import java.rem.RemObject;
import MyObject;

class Test {
 public static void main(String[] args) {
  MyObject obj = new MyObject();
  RemObject.met1(obj);
  obj = null;
  System.gc();
  }
}

///////////// libraries/javalib/java/rem/RemObject.java
public class RemObject {
   public static void met1(Object obj) {
    nmet1(obj);
   }
   static native void nmet1(Object obj);
}

//////////// libraries/clib/native/Remote.c
void
java_rem_RemObject_nmet1(struct Hjava_lang_Object* obj) {
 ...
 auxPtr = obj; // This is a global variable.
}
//////////////////////////////////////////////

The GC reaches the memory pointed by auxPtr and marks it Black.
I suppose that this happens because I have a pointer to that piece of
memory in auxPtr, but I can't figure out how it is reached by the
Collector.
In other words, I need to know if this memory is being used by the "user
Java program" (in this case, it is not), Could the Collector tell me
this?

Thank you in advance.
Ivana Visconti



More information about the kaffe mailing list