This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: CNI and garbage collection
- To: "Marcus G. Daniels" <mgd at swarm dot org>
- Subject: Re: CNI and garbage collection
- From: Jeff Sturm <jsturm at one-point dot com>
- Date: Thu, 19 Jul 2001 22:37:41 -0400 (EDT)
- cc: java at gcc dot gnu dot org
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