RFR: 8287809: Revisit implementation of memory session [v4]

Maurizio Cimadamore mcimadamore at openjdk.org
Fri Jun 17 20:42:59 UTC 2022


On Fri, 17 Jun 2022 18:39:03 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> This is a JDK 19 clone of: https://urldefense.com/v3/__https://github.com/openjdk/jdk/pull/9017__;!!ACWV5N9M2RV99hQ!Off-l8NwzAhR8cTQMgW01NR8g_uIjxXm-ftxHRQTWaGPkYDn4G75Nu_mGQ7UaX1HyCOQcQqZA0SL02LVyrHqkt4deq2b$ 
>
> 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



More information about the security-dev mailing list