CNI and garbage collection
Marcus G. Daniels
mgd@swarm.org
Thu Jul 19 18:54:00 GMT 2001
I've got a Java class from which I generate headers using gcjh. I'm
using the -prepend and -add features to insert declarations for ivars
types, and then the ivars themselves. In a CNI native method I have
some initialization code for setting up the C++ side of things. The
problem seems to be that garbage collection is moving my Java object,
but the ivars aren't following. I.e. if I disable garbage collection
the program runs fine.
In the CNI documentation,
http://gcc.gnu.org/java/papers/cni/t1308.html
it says that "The C++ compiler is smart enough to realize the class is
a Java class, and hence it needs to allocate memory from the garbage
collector."
But what about the C++ objects inside of the Java object? Is there a special
way to allocate them?
More information about the Java
mailing list