CNI and garbage collection

Jeff Sturm jsturm@one-point.com
Thu Jul 19 19:34:00 GMT 2001


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


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /