dissecting memory sessions
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Thu Nov 10 17:06:16 UTC 2022
On 10/11/2022 16:52, Pedro Lamarão wrote:
> IMHO, though the concern is clearly with reasoning about life-time, I
> think the design is improving in another direction, the specification
> of a clear, well defined, common memory allocator "service".
I'm glad you noticed. Really, one of the things that didn't quite click
in the Java 19 API was to see how hard it was to construct a custom
allocator implementing a custom policy. This should be, in my opinion,
the bread and butter of the FFM API, so we need to make it easy(er) for
libraries to come up with their own allocators. The fact that, in Java
19, all custom closeable allocators need to protect themselves against
"sneaky" close (e.g clients calling close on the segments they return)
is a major source of problem - both conceptual (because all implementors
of custom allocators will have to worry about creating non-closeable
views and attaching segments there), and practical (because creating all
these views has a non trivial performance cost, given that the very
existence of session views makes everything less monomorphic).
Thanks
Maurizio
More information about the panama-dev
mailing list