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]

Re: CNI and garbage collection




On 19 Jul 2001, Marcus G. Daniels wrote:
> The problem seems to be that garbage collection is moving my Java
> object, but the ivars aren't following.

Well, boehm-gc isn't a moving collector, but it is possible you have
objects that are swept prematurely.

If a C++ object contains references to Java objects, they won't be seen by
the collector.

> But what about the C++ objects inside of the Java object?  Is there a special
> way to allocate them?

I don't know.  You could try to override the "new" operator to place C++
objects where they will be traced.  But that exposes details of the
collector implementation, and could have other pitfalls when done
together with libgcj.  See boehm-gc/include/gc_cpp.h for more info.

Jeff


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