Update: MemorySegment has copyTo(...) method, which should be used.