[foreign-memaccess+abi] RFR: MemorySegmentPool + Allocator [v11]
Radoslaw Smogura
github.com+7535718+rsmogura at openjdk.java.net
Mon Apr 26 12:25:52 UTC 2021
On Sat, 24 Apr 2021 11:14:01 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> Radoslaw Smogura has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Adjust to latest changes
>> Remove direct API
>> Prevent keeping hard reference to shared scope, through chain cleaner, pooled allocator, pool scope
>
> src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemorySegmentPool.java line 316:
>
>> 314: this.sourceAddress = sourceAddress;
>> 315:
>> 316: ((ResourceScopeImpl) scope).addOrCleanupIfFail(new ResourceCleanup() {
>
> Not 100% sure you need this. You already have added a cleanup action which calls `ClearRunnable`. Why not just deallocating stuff from there? In fact, I think the scope should be also moved to the spin lock queue - each queue has a scope, and when the scope is closed, the queue is locked, and all entries inside it are released. This will save a cleanup action addition on every new memory pool item (that's how I'd do it at least).
That's very fair point!!! Thanks.
After calling cleaner queue max size is set to 0, so any pending entry will have to be released on close.
Outstanding entires can be closed using iterator.
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/509
More information about the panama-dev
mailing list