On Fri, 2 May 2025 11:36:56 GMT, Maurizio Cimadamore <mcimadam...@openjdk.org> wrote:
>> Per Minborg has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Cleanup and only create CleanupAction once per thread > > src/java.base/share/classes/jdk/internal/foreign/BufferStack.java line 127: > >> 125: arena, >> 126: new SlicingAllocator(arena.allocate(byteSize, >> byteAlignment)), >> 127: new CleanupAction(arena)); > > any reason why you didn't use a lambda here? Also, not a big fan of records here -- it seems that many implementation details such as cleanup action, lock and slicing allocator are "leaked out" to the caller, that is now responsible to set things up correctly. I think a `PerThread` class with a constructor taking arena, size, alignment would make the code less coupled and more readable. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/24829#discussion_r2071496742