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:19:29 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> 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.
The choice here is: if we allow non-zeroing implementation, implementors of Arena have more flexibility, but clients have less guarantees (how does a client know if what they get back is zeroed?)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17308#discussion_r1447452246
More information about the core-libs-dev
mailing list