This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: Storing C++ data in an instance field using CNI?
- From: Andrew Haley <aph at redhat dot com>
- To: Bryce McKinlay <mckinlay at redhat dot com>
- Cc: Stanley Brown <stanley dot brown at zimmer dot com>, java at gcc dot gnu dot org
- Date: Wed, 26 May 2004 17:11:36 +0100
- Subject: Re: Storing C++ data in an instance field using CNI?
- References: <40B4A105.90909@zimmer.com><40B4BE24.9060104@redhat.com>
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.