On Thu, 23 Jan 2025 12:50:41 GMT, Matthias Ernst <d...@openjdk.org> wrote:

>> So:
>> * the shared memory segment is confined on the carrier thread
>> * allocation requests need to reinterpret segment slices to the arena (which 
>> is associated with the requesting thread, not the carrier)
>> * my understanding is that the terminating action will be executed on the 
>> same carrier thread (so closing the confined arena should be ok)
>
>> the shared memory segment is confined on the carrier thread
> 
> But is it? When the CarrierThreadLocal is initialized, we may be executing in 
> a VT and Arena.ofConfined will confine to it. We'd need something like an 
> Arena.ofCarrierConfined() to make that work.

I mean, it is totally possible:

        public PerThread(long size) {
            this.arena = 
MemorySessionImpl.createConfined(JLA.currentCarrierThread()).asArena();
            this.stack = new SlicingAllocator(arena.allocate(size));
        }

        public void close() {
            arena.close();
        }

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/23142#discussion_r1926940819

Reply via email to