Re: gnu.gcj.RawData vs. long

Bryce McKinlay <[email protected]>
Newsgroups gmane.comp.gcc.java.devel
Message-ID <CALUNu-rVDwBG-GdwM_xfYu=n-uoT4gdK9RWau4PV5uhjss1JJw@mail.gmail.com>
On Mon, Jul 18, 2011 at 5:08 PM, Craig Vanderborgh
<[email protected]> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.