changeset 57566:4a0a1b927608

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
author mcimadamore
date Thu, 16 Jan 2020 14:55:26 +0000
parents 4bb6c4bf72bf
children b4ccf83030cf
files src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemorySegment.java
diffstat 1 files changed, 9 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemorySegment.java	Thu Jan 16 15:50:23 2020 +0100
+++ b/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemorySegment.java	Thu Jan 16 14:55:26 2020 +0000
@@ -348,10 +348,9 @@
     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 @@
     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 @@
      * 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.