RFR: 8323159: Consider adding some text re. memory zeroing in Arena::allocate

Maurizio Cimadamore mcimadamore at openjdk.org
Wed Jan 10 14:24:24 UTC 2024


On Wed, 10 Jan 2024 14:12:02 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> This PR proposes to add a clarification that an `Arena` always returns zeroed-out segments for `Arena::allocate` methods.
>> 
>> Note that other overloaded methods refer to the abstract `Arena::allocate` method via implementation notes.
>
> src/java.base/share/classes/java/lang/foreign/Arena.java line 269:
> 
>> 267:      * @implSpec
>> 268:      * Implementations of this method must return a native, zero-initialized segment
>> 269:      * featuring the requested size, and that is compatible with the provided alignment
> 
> Do we want to _mandate_ that all arenas return zero-initialized memory? Maybe it's enough to say that the default implementation does this.

It's not a default method. That said, according to this suggestion it could be possible to move the text in the ofAuto/ofConfined/ofArena factories.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17308#discussion_r1447449904


More information about the core-libs-dev mailing list