GC and Objects not used

Archie Cobbs archie at whistle.com
Sat Oct 16 17:48:34 PDT 1999

Ivana Visconti writes:
> //////////// 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.

If what you want is to guarantee that there is a reference, JNI
has a function for adding one.

> 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?

In general, no, because in Java there is no guarantee that the GC
actually finds all garbage. I don't know about kaffe in particular,
but it probably would be easy to do.


Archie Cobbs   *   Whistle Communications, Inc.  *   http://www.whistle.com

More information about the kaffe mailing list