Pinning of on-heap MemorySegment

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Mon Aug 28 14:57:48 UTC 2023


On 28/08/2023 15:52, Pedro Lamarão wrote:
> Em seg., 28 de ago. de 2023 às 11:45, Maurizio Cimadamore 
> <maurizio.cimadamore at oracle.com> escreveu:
>
>     To get rid of the warning, you have to explicitly opt-in the calling
>     module into native access (which is done using the
>     --enable-native-access command line flag).
>
>
> If I understand correctly, you are worried about the specific 
> combination of native memory pinning with GC's incapable of granular 
> pinning.
> Wouldn't it be sufficient to warn about this specific combination, 
> maybe even suggesting a more appropriate, alternative GC?
> "warning: GC globally locked by native memory pinning (consider 
> switching to XYZ GC)"

Yes, that is the worry. Note that, at the time of writing, only 
Shenandoah (which is going to be removed from 22) supports region-based 
pinning.

Support for region-based pinning for G1 (the default) is in the works:

https://bugs.openjdk.org/browse/JDK-8276094

So, I believe that before we provide such an API, we should at least 
make sure we have _some_ GC which allow to pin w/o using GC locker.

Cheers
Maurizio

>
> -- 
> Pedro Lamarão
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/panama-dev/attachments/20230828/ba490e21/attachment-0001.htm>


More information about the panama-dev mailing list