FMA-17 MemorySegment needs a isNative()
Chris Vest
mr.chrisvest at gmail.com
Tue May 11 09:22:55 UTC 2021
For what it's worth we have a similar try-catch in the Netty integration.
We have a method on our Buffer interface for querying a buffers native
address, which returns 0 as a special value for heap buffers.
We use this information to decide how to do certain IO calls.
On Tue, 20 Apr 2021 at 11:58, Maurizio Cimadamore <
maurizio.cimadamore at oracle.com> wrote:
> We'll consider this.
>
> In the meantime, you can emulate the check with this:
>
> try {
> segment.address().toRawLongValue()
> return true;
> } catch (UnsupportedOperationException ex) {
> return false;
> }
>
> Not great, but works :-)
>
> Maurizio
>
>
> On 20/04/2021 00:29, leerho wrote:
> > It would be very useful to be able to determine from just a given
> > MemorySegment if it is off-heap or on-heap. If a custom allocator gets a
> > request from a child process for a new segment, the allocator needs to
> know
> > whether that segment should be allocated on-heap or off-heap.
> >
> > A simple *boolean isNative() would do the trick.*
> >
> > Lee.
>
More information about the panama-dev
mailing list