@@ -761,8 +761,13 @@ public sealed interface MemorySegment permits AbstractMemorySegmentImpl {
761761 * arena: that is, if the provided arena is a {@linkplain Arena#ofConfined() confined arena},
762762 * the returned segment can only be accessed by the arena's owner thread, regardless
763763 * of the confinement restrictions associated with this segment. In other words, this
764- * method returns a segment that behaves as if it had been allocated using the
765- * provided arena.
764+ * method returns a segment that can be used as any other segment allocated using the
765+ * provided arena. However, The returned segment is backed by the same memory region
766+ * as that of the original segment. As such, the region of memory backing the
767+ * returned segment is deallocated only when this segment's arena is closed.
768+ * This might lead to <em>use-after-free</em> issues, as the returned segment can be
769+ * accessed <em>after</em> its region of memory has been deallocated via this
770+ * segment's arena.
766771 * <p>
767772 * Clients can specify an optional cleanup action that should be executed when the
768773 * provided scope becomes invalid. This cleanup action receives a fresh memory
@@ -811,9 +816,14 @@ public sealed interface MemorySegment permits AbstractMemorySegmentImpl {
811816 * compatibly with the confinement restrictions associated with the provided arena:
812817 * that is, if the provided arena is a {@linkplain Arena#ofConfined() confined arena},
813818 * the returned segment can only be accessed by the arena's owner thread, regardless
814- * of the confinement restrictions associated with this segment. In other words,
815- * this method returns a segment that behaves as if it had been allocated using the
816- * provided arena.
819+ * of the confinement restrictions associated with this segment. In other words, this
820+ * method returns a segment that can be used as any other segment allocated using the
821+ * provided arena. However, The returned segment is backed by the same memory region
822+ * as that of the original segment. As such, the region of memory backing the
823+ * returned segment is deallocated only when this segment's arena is closed.
824+ * This might lead to <em>use-after-free</em> issues, as the returned segment can be
825+ * accessed <em>after</em> its region of memory has been deallocated via this
826+ * segment's arena.
817827 * <p>
818828 * Clients can specify an optional cleanup action that should be executed when the
819829 * provided scope becomes invalid. This cleanup action receives a fresh memory
0 commit comments