[foreign-memaccess+abi] RFR: 8293400: Modify static constructors in MemorySegment [v2]
Maurizio Cimadamore
mcimadamore at openjdk.org
Tue Sep 13 12:07:28 UTC 2022
On Tue, 13 Sep 2022 11:45:31 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> Per Minborg has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Simplify creatons of MemorySegments in tests
>
> src/java.base/share/classes/java/lang/foreign/MemorySegment.java line 957:
>
>> 955: * The memory segment is automatically freed some unspecified time after it is no longer referenced.
>> 956: * If a memory segment needs to be deterministically freed, use an appropriate memory session from which
>> 957: * {@linkplain MemorySession#allocate(MemoryLayout) allocation} can be made instead.
>
> Suggestion:
>
> * The returned memory segment is associated with an {@linkplain MemorySession#openImplicit implicit} memory session. As such, the native memory region associated with the returned segment is freed <em>automatically</em>, some unspecified time after it is no longer referenced. Native segments featuring deterministic deallocation can be obtained using the {MemorySession#allocate} method.
Also, add a `@see` for `MemorySession::allocate` (and probably also one in `MemorySession::allocate` to here)
-------------
PR: https://git.openjdk.org/panama-foreign/pull/718
More information about the panama-dev
mailing list