[foreign-memaccess] RFR: 8253025: Add support for registering a segment with a Cleaner [v2]

Maurizio Cimadamore mcimadamore at openjdk.java.net
Fri Sep 11 10:48:55 UTC 2020


On Thu, 10 Sep 2020 23:12:05 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:

>> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Addressed review comments
>>   Beefed up test
>
> src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/MemoryScope.java line 323:
> 
>> 321:                 @Override
>> 322:                 void run() {
>> 323:                     BasicCleanupAction.this.run();
> 
> This has the effect of chaining calls, that might accumulate over time. I don't see how to avoid this unless a
> delegating model is used. But IIUC you want to avoid creating two objects, the "clean up" action as a `Runnable` then
> the "scope close action" encapsulating the "clean up" action. Perhaps when inline types are available we can do better.

I think this is addresses in latest iteration; I used a local class which keeps track of the "root" action, and keeps
propagating it. So calls always hit the root action, no chaining.

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

PR: https://git.openjdk.java.net/panama-foreign/pull/320


More information about the panama-dev mailing list