8242477: (bf) MappedByteBuffer should clarify copying between overlapping mappings

Brian Burkhalter brian.burkhalter at oracle.com
Mon Apr 13 19:23:58 UTC 2020


> On Apr 13, 2020, at 8:49 AM, Alan Bateman <Alan.Bateman at oracle.com> wrote:
> 
> On 13/04/2020 16:42, Brian Burkhalter wrote:
>> 
>>> On Apr 11, 2020, at 4:23 AM, Florian Weimer <fw at deneb.enyo.de <mailto:fw at deneb.enyo.de>> wrote:
>>> 
>>> In principle, this also applies to direct buffer created via JNI's
>>> NewDirectByteBuffer.  Such direct buffers could alias with each other
>>> or even MappedByteBuffer instances.
>> 
>> Indeed. And in an even simpler case, two different views of the same direct buffer could produce unexpected results with a relative bulk put from one into the other.
>> 
> Yes, it's a good point. Can you check out whether the statement could be added to the BB "Direct vs. non-direct buffer" sections.

Something like this maybe could be appended to the penultimate paragraph in ByteBuffer's direct v. indirect section:

"The result of a bulk copy between two direct buffers is unspecified if they correspond to overlapping regions of the same native storage.”

Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20200413/1f3335b8/attachment-0001.htm>


More information about the nio-dev mailing list