gnu.gcj.RawData vs. long
Bryce McKinlay
bmckinlay@gmail.com
Mon Jul 18 16:18:00 GMT 2011
On Mon, Jul 18, 2011 at 5:08 PM, Craig Vanderborgh
<craigvanderborgh@gmail.com> wrote:
> The problem is that gnu.gcj.RawData * is not portable. The question
> is: can I use "long" for the type instead without garbage collection
> problems? Can my native code store the pointer value in a Java "long"
> in the CNI with impunity, or will Boehm GC think these pointers needs
> to be considered for collection?
Hi Craig.
You must use gnu.gcj.RawData* if the reference being stored points to
something allocated by the GC. The GC will not mark references held in
non-pointer types.
If it's something that was allocated outside the GC (ie, with malloc),
it should be fine to use a long.
Bryce
More information about the Java
mailing list