On Fri, 17 Jun 2022 20:39:40 GMT, Maurizio Cimadamore <mcimadam...@openjdk.org> wrote:
>> 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. I've filed a dependent PR for this: https://urldefense.com/v3/__https://github.com/openjdk/jdk19/pull/39__;!!ACWV5N9M2RV99hQ!LQxkLIaI9ySs-LLe36ur5jBGBzDzPz3HI6H08K6ip4I6R8lrvK5XPEanQPSunGcdyVgWqnWwrlTg4c0Z5XD7vAYTBDZvZw$ ------------- PR: https://git.openjdk.org/jdk19/pull/22