RFR: 8324972: (bf) Make DirectByteBuffer.Deallocator idempotent [v4]

Per Minborg pminborg at openjdk.org
Fri Feb 16 14:50:57 UTC 2024


On Thu, 15 Feb 2024 16:58:20 GMT, Mark Sheppard <msheppar at openjdk.org> wrote:

>> Per Minborg has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - Use existing UNSAFE static variable
>>  - Remove unused import
>
> forget concurrency, forget idempotency, forget safe publication across threads etc.
> Ask the question what is the Deallocator state representing ... it is encapsulating a  native memory address that should be freed by an os::free, and when that has been successfully executed, its state should show that referenced address should no longer be freed, becuse that potential side effects.
> That's a simple and precise propsition.
> 
> Why are you trying to justify the use of a record to represent Deallocator state as immutable, when that state is not immutable

I think we have concluded that the Cleaner can only run items at most once and that there is no other way the closers can run. So, with this in mind, can you resolve the issue as "Not an issue" @msheppar ?

The old "if (address == 0)" must be old code from before the Cleaner era.

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

PR Comment: https://git.openjdk.org/jdk/pull/17647#issuecomment-1948519999


More information about the nio-dev mailing list