Storing C++ data in an instance field using CNI?

Tom Tromey tromey@redhat.com
Tue May 25 19:22:00 GMT 2004


>>>>> "Paul" == Paul Gear <paul@gear.dyndns.org> writes:

Paul> More questions along the same topic: has _Jv_AllocBytes been deprecated
Paul> or something?  It appears in the doco at
Paul> http://gcc.gnu.org/java/papers/cni/t1308.html
Paul> and
Paul> http://gcc.gnu.org/onlinedocs/gcj/Object-allocation.html#Object%20allocation
Paul> but when i try to use it it is not defined.

It isn't declared in cni.h.  IMO we shouldn't document or export any
_Jv_ function, only `Jv' functions.

Paul> Also, assuming _Jv_AllocBytes() is still the right thing to use, does it
Paul> return zeroed memory?

Yes, it does.

I'm not sure this is what you want.  It doesn't make sense to store
the result of _Jv_AllocBytes in a RawData field.  Those fields aren't
scanned, and as _Jv_AllocBytes returns collectible memory, it won't be
considered live.  You probably just want JvMalloc or plain old malloc.

Tom



More information about the Java mailing list