Pinning of on-heap MemorySegment

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Mon Aug 28 16:58:24 UTC 2023


On 28/08/2023 17:56, Radosław Smogura wrote:
> I think other approach would be for ImageIO to use MemorySegment instead of operating on int arrays.
>
> For programming like CUDA this can bring additional benefits like using memory mapping between host and device.

I 100% agree with this.

Again, I don't dispute the performance benefit of pinning - but, with a 
different API, there would be no reason to do pinning (nor copy) in the 
first place. It might be that pinning is the "pragmatic" solution to 
interact with such array-biased APIs, but I also hope we can fix some of 
the tension in the existing APIs (especially if such APIs happen to be 
in the JDK).

Maurizio



More information about the panama-dev mailing list