8237348: Javadoc of MemorySegment::allocateNative should state that memory is zero-initialized8237348: Javadoc of MemorySegment::allocateNative should state that memory is zero-initialized

Reviewed-by: chegar, jlaskey
This commit is contained in:
Maurizio Cimadamore 2020-01-16 14:55:26 +00:00
parent 5903e20af2
commit af5ff9aeee

View File

@ -348,10 +348,9 @@ public interface MemorySegment extends AutoCloseable {
allocateNative(layout.bytesSize(), layout.bytesAlignment());
* }</pre></blockquote>
*
* @implNote The initialization state of the contents of the block of off-heap memory associated with the returned native memory
* segment is unspecified and should not be relied upon. Moreover, a client is responsible to call the {@link MemorySegment#close()}
* on a native memory segment, to make sure the backing off-heap memory block is deallocated accordingly. Failure to do so
* will result in off-heap memory leaks.
* @implNote The block of off-heap memory associated with the returned native memory segment is initialized to zero.
* Moreover, a client is responsible to call the {@link MemorySegment#close()} on a native memory segment,
* to make sure the backing off-heap memory block is deallocated accordingly. Failure to do so will result in off-heap memory leaks.
*
* @param layout the layout of the off-heap memory block backing the native memory segment.
* @return a new native memory segment.
@ -369,10 +368,9 @@ public interface MemorySegment extends AutoCloseable {
allocateNative(bytesSize, 1);
* }</pre></blockquote>
*
* @implNote The initialization state of the contents of the block of off-heap memory associated with the returned native memory
* segment is unspecified and should not be relied upon. Moreover, a client is responsible to call the {@link MemorySegment#close()}
* on a native memory segment, to make sure the backing off-heap memory block is deallocated accordingly. Failure to do so
* will result in off-heap memory leaks.
* @implNote The block of off-heap memory associated with the returned native memory segment is initialized to zero.
* Moreover, a client is responsible to call the {@link MemorySegment#close()} on a native memory segment,
* to make sure the backing off-heap memory block is deallocated accordingly. Failure to do so will result in off-heap memory leaks.
*
* @param bytesSize the size (in bytes) of the off-heap memory block backing the native memory segment.
* @return a new native memory segment.
@ -404,10 +402,9 @@ public interface MemorySegment extends AutoCloseable {
* Creates a new native memory segment that models a newly allocated block of off-heap memory with given size and
* alignment constraint (in bytes).
*
* @implNote The initialization state of the contents of the block of off-heap memory associated with the returned native memory
* segment is unspecified and should not be relied upon. Moreover, a client is responsible to call the {@link MemorySegment#close()}
* on a native memory segment, to make sure the backing off-heap memory block is deallocated accordingly. Failure to do so
* will result in off-heap memory leaks.
* @implNote The block of off-heap memory associated with the returned native memory segment is initialized to zero.
* Moreover, a client is responsible to call the {@link MemorySegment#close()} on a native memory segment,
* to make sure the backing off-heap memory block is deallocated accordingly. Failure to do so will result in off-heap memory leaks.
*
* @param bytesSize the size (in bytes) of the off-heap memory block backing the native memory segment.
* @param alignmentBytes the alignment constraint (in bytes) of the off-heap memory block backing the native memory segment.