This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: gnu.gcj.RawData vs. long
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