mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +02:00
8323159: Consider adding some text re. memory zeroing in Arena::allocate
Reviewed-by: mcimadamore, jvernee
This commit is contained in:
parent
1f4474f677
commit
f5b757ced6
2 changed files with 51 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -219,6 +219,9 @@ public interface Arena extends SegmentAllocator, AutoCloseable {
|
|||
* Segments allocated with the returned arena can be
|
||||
* {@linkplain MemorySegment#isAccessibleBy(Thread) accessed} by any thread.
|
||||
* Calling {@link #close()} on the returned arena will result in an {@link UnsupportedOperationException}.
|
||||
* <p>
|
||||
* Memory segments {@linkplain #allocate(long, long) allocated} by the returned arena
|
||||
* are zero-initialized.
|
||||
*
|
||||
* @return a new arena that is managed, automatically, by the garbage collector
|
||||
*/
|
||||
|
@ -231,6 +234,9 @@ public interface Arena extends SegmentAllocator, AutoCloseable {
|
|||
* {@linkplain MemorySegment#isAccessibleBy(Thread) accessed} by any thread.
|
||||
* Calling {@link #close()} on the returned arena will result in
|
||||
* an {@link UnsupportedOperationException}.
|
||||
* <p>
|
||||
* Memory segments {@linkplain #allocate(long, long) allocated} by the returned arena
|
||||
* are zero-initialized.
|
||||
*/
|
||||
static Arena global() {
|
||||
class Holder {
|
||||
|
@ -243,6 +249,9 @@ public interface Arena extends SegmentAllocator, AutoCloseable {
|
|||
* {@return a new confined arena} Segments allocated with the confined arena can be
|
||||
* {@linkplain MemorySegment#isAccessibleBy(Thread) accessed} by the thread
|
||||
* that created the arena, the arena's <em>owner thread</em>.
|
||||
* <p>
|
||||
* Memory segments {@linkplain #allocate(long, long) allocated} by the returned arena
|
||||
* are zero-initialized.
|
||||
*/
|
||||
static Arena ofConfined() {
|
||||
return MemorySessionImpl.createConfined(Thread.currentThread()).asArena();
|
||||
|
@ -251,6 +260,9 @@ public interface Arena extends SegmentAllocator, AutoCloseable {
|
|||
/**
|
||||
* {@return a new shared arena} Segments allocated with the global arena can be
|
||||
* {@linkplain MemorySegment#isAccessibleBy(Thread) accessed} by any thread.
|
||||
* <p>
|
||||
* Memory segments {@linkplain #allocate(long, long) allocated} by the returned arena
|
||||
* are zero-initialized.
|
||||
*/
|
||||
static Arena ofShared() {
|
||||
return MemorySessionImpl.createShared().asArena();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue