Storing C++ data in an instance field using CNI?
Andrew Haley
aph@redhat.com
Wed May 26 16:18:00 GMT 2004
Bryce McKinlay writes:
>
> I'm thinking of adding something like "RawDataMarked" which would be
> like RawData but would be checked by the GC. This way you could allocate
> a native struct using JvAllocBytes(), and it would be automatically
> freed when the Java object becomes unreachable. No need for a finalizer.
>
> Thoughts?
I'm wondering why not use a jbyte[]. The advantage over a jbyte[] is
1. efficiency?
2. alignment, perhaps?
One related issue we might like to consider.
RawData is final. I'm pretty sure this is wrong: being able to
subclass RawData would allow us to define typed pointers. The use of
RawData to point to all manner of things with no type information does
no-one any good.
Andrew.
More information about the Java
mailing list