As per the spec of
https://download.java.net/java/early_access/jdk19/docs/api/java.base/java/lang/foreign/SegmentAllocator.html#allocateUtf8String(java.lang.String)
the default implementation for this method copies the contents of the provided Java string into a new memory segment obtained by calling this.allocate(str.length() + 1).
Expectations :
invoking allocateUtf8String(String str) shall delegate a call to allocate(long)
Actual :
The method allocate(long) not invoked, instead allocate(long, long) is invoked.