This is the mail archive of the java@gcc.gnu.org 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]

CNI and garbage collection


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?


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