RFR: 8340307: Add explanation around MemorySegment:reinterpret regarding arenas

Maurizio Cimadamore mcimadamore at openjdk.org
Wed Oct 30 13:02:08 UTC 2024


On Wed, 30 Oct 2024 12:57:50 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> But then, somewhere else say:
> 
> "The returned segment is backed by the same memory region as that of the original segment. As such, the region of memory backing the returned segment is truly deallocated only when the original segment's arena is closed."

Bonus points if we can also add something re. the fact that this can cause two issues:

1. a client might access the reinterpreted segment _after_ its region of memory has been deallocated
2. the region of memory "outlives" the reinterpreted segment - e.g. even after the provided arena is closed

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/21761#discussion_r1822575744


More information about the core-libs-dev mailing list