On Fri, 17 Jun 2022 18:39:03 GMT, Maurizio Cimadamore <mcimadam...@openjdk.org> wrote:
>> This is a JDK 19 clone of: >> https://urldefense.com/v3/__https://github.com/openjdk/jdk/pull/9017__;!!ACWV5N9M2RV99hQ!PTgf-96nF99J6u5zXvgIK8gDa_y-GwCjRZ0uALQAk5zZJ7sIb8lIrdasF6oRY-U2YqR3JXkv4CFtxlWidLpOuYm5qPP4KA$ >> > > Maurizio Cimadamore has updated the pull request incrementally with one > additional commit since the last revision: > > Revert implicit vs. heap session changes src/java.base/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java line 530: > 528: bufferSession = bufferSegment.session; > 529: } else { > 530: bufferSession = MemorySessionImpl.heapSession(bb); I think this should be tweaked (as part of another patch). Buffer segments should have same lifecycle of array segments - and array segments have the global session. This is because an array segment always keeps the underlying array alive. I think we should enhance memory segment implementation (esp. that of native segments), so that it can be used to keep other objects alive. This would be useful also in the `loaderLookup` where we create another of those odd sessions - in that case we should just say that the segments returned by loader lookup have global scope, and keep the loader alive. ------------- PR: https://git.openjdk.org/jdk19/pull/22