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

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


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

>> 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?)
>
>> (how does a client know if what they get back is zeroed?)
> 
> It seems similar to e.g. a HashMap vs. LinkedHashMap with regards to ordering. The creator of the Arena would decide the zeroing strategy.

Not sure if that analogy is 100% correct. In that case a client that takes a `Map`, but wants order, can say to accept e.g. a `SequencedMap`. In the case of `Arena`, there's no subtype which adds the "zeroing" characteristics. So a client accepting an arena, and doing some allocation would be effectively at the mercy of who created the arena. I think one can argue this both ways.

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

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


More information about the core-libs-dev mailing list