@@ -630,6 +630,9 @@ public sealed interface MemorySegment permits AbstractMemorySegmentImpl {
630
630
* {@snippet lang=java :
631
631
* asSlice(offset, newSize, 1);
632
632
* }
633
+ * <p>
634
+ * The returned memory segment shares a region of backing memory with this segment.
635
+ * Hence, no memory will be allocated or freed by this method.
633
636
*
634
637
* @see #asSlice(long, long, long)
635
638
*
@@ -646,6 +649,9 @@ public sealed interface MemorySegment permits AbstractMemorySegmentImpl {
646
649
* Returns a slice of this memory segment, at the given offset, with the provided
647
650
* alignment constraint. The returned segment's address is the address of this
648
651
* segment plus the given offset; its size is specified by the given argument.
652
+ * <p>
653
+ * The returned memory segment shares a region of backing memory with this segment.
654
+ * Hence, no memory will be allocated or freed by this method.
649
655
*
650
656
* @param offset The new segment base offset (relative to the address of this segment),
651
657
* specified in bytes
@@ -670,6 +676,9 @@ public sealed interface MemorySegment permits AbstractMemorySegmentImpl {
670
676
* {@snippet lang=java :
671
677
* asSlice(offset, layout.byteSize(), layout.byteAlignment());
672
678
* }
679
+ * <p>
680
+ * The returned memory segment shares a region of backing memory with this segment.
681
+ * Hence, no memory will be allocated or freed by this method.
673
682
*
674
683
* @see #asSlice(long, long, long)
675
684
*
@@ -693,6 +702,9 @@ public sealed interface MemorySegment permits AbstractMemorySegmentImpl {
693
702
* {@snippet lang=java :
694
703
* asSlice(offset, byteSize() - offset);
695
704
* }
705
+ * <p>
706
+ * The returned memory segment shares a region of backing memory with this segment.
707
+ * Hence, no memory will be allocated or freed by this method.
696
708
*
697
709
* @see #asSlice(long, long)
698
710
*
@@ -706,6 +718,9 @@ public sealed interface MemorySegment permits AbstractMemorySegmentImpl {
706
718
/**
707
719
* Returns a new memory segment that has the same address and scope as this segment,
708
720
* but with the provided size.
721
+ * <p>
722
+ * The returned memory segment shares a region of backing memory with this segment.
723
+ * Hence, no memory will be allocated or freed by this method.
709
724
*
710
725
* @param newSize the size of the returned segment
711
726
* @return a new memory segment that has the same address and scope as
@@ -741,6 +756,9 @@ public sealed interface MemorySegment permits AbstractMemorySegmentImpl {
741
756
* That is, the cleanup action receives a segment that is associated with the global
742
757
* scope, and is accessible from any thread. The size of the segment accepted by the
743
758
* cleanup action is {@link #byteSize()}.
759
+ * <p>
760
+ * The returned memory segment shares a region of backing memory with this segment.
761
+ * Hence, no memory will be allocated or freed by this method.
744
762
*
745
763
* @apiNote The cleanup action (if present) should take care not to leak the received
746
764
* segment to external clients that might access the segment after its
@@ -786,6 +804,9 @@ public sealed interface MemorySegment permits AbstractMemorySegmentImpl {
786
804
* That is, the cleanup action receives a segment that is associated with the global
787
805
* scope, and is accessible from any thread. The size of the segment accepted by the
788
806
* cleanup action is {@code newSize}.
807
+ * <p>
808
+ * The returned memory segment shares a region of backing memory with this segment.
809
+ * Hence, no memory will be allocated or freed by this method.
789
810
*
790
811
* @apiNote The cleanup action (if present) should take care not to leak the received
791
812
* segment to external clients that might access the segment after its
0 commit comments