<div dir="ltr">Hi team.<div>I am working with foreign API and noticed that offsets are treated differently for the "set" and "copy" methods of MemorySegment in the case of heap-based segments. </div><div><br clear="all"><div>If I create a segment from let's say, byte[] and call "set(OfDouble, 0)" on such a segment it doesn't take array offset into account during the calculation of the applied offset value. So it processes this offset as is, and I get an exception about address misalignment. </div><div>But if I pass offsets into the "copy" method, they are automatically corrected.</div><div><br></div><div>Is it done by design? </div><div>IMHO, both methods should treat offsets uniformly, and that is not taking into account that such treatments of offsets in "set" methods make it very hard to work with heap-based segments.</div><div><br></div><div>P.S. I am using JDK 20.</div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr">Best regards,<br>Andrii Lomakin.<br><br></div></div></div></div></div></div>