https://download.java.net/java/early_access/jdk21/docs/api/java.base/java/lang/foreign/SegmentAllocator.html#allocateUtf8String(java.lang.String)
Spec mentions that - "Returns:
a new native segment containing the converted C string."
But this looks not true for all types of SegmentAlloctor's.
For example :
===
SegmentAllocator segmentAllocator1 = SegmentAllocator.prefixAllocator(MemorySegment.ofArray(new int[16]));
MemorySegment memorySegment = segmentAllocator1.allocateUtf8String(strVal);
System.out.println(memorySegment.isNative());
===
The spec needs to be updated to align with the behavior.