* gnu.gcj.RawData vs. long
@ 2011-07-18 16:08 Craig Vanderborgh
2011-07-18 16:18 ` Bryce McKinlay
0 siblings, 1 reply; 2+ messages in thread
From: Craig Vanderborgh @ 2011-07-18 16:08 UTC (permalink / raw)
To: java
Hello all:
I am working to make some of our code more portable. We "gcj-ified"
our source several years back, including making liberal use of
gnu.gcj.RawData * class members to store pointers for native (CNI)
code within object instances.
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?
Please advise.
Thanks in advance,
Craig Vanderborgh
Voxware Incorporated
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: gnu.gcj.RawData vs. long
2011-07-18 16:08 gnu.gcj.RawData vs. long Craig Vanderborgh
@ 2011-07-18 16:18 ` Bryce McKinlay
0 siblings, 0 replies; 2+ messages in thread
From: Bryce McKinlay @ 2011-07-18 16:18 UTC (permalink / raw)
To: Craig Vanderborgh; +Cc: java
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-07-18 16:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-18 16:08 gnu.gcj.RawData vs. long Craig Vanderborgh
2011-07-18 16:18 ` Bryce McKinlay
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).