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

Paul Sandoz paul.sandoz at oracle.com
Mon Apr 13 16:14:19 UTC 2020



> On Apr 13, 2020, at 8:50 AM, Brian Burkhalter <brian.burkhalter at oracle.com> wrote:
> 
> 
> 
>> On Apr 13, 2020, at 8:49 AM, Alan Bateman <Alan.Bateman at oracle.com <mailto: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.
> 
> I verified it with a small test.
> 

Is that due to the buffer implementation (in some cases not using the Unsafe mem-copy) rather than mapping two sources at different virtual memory addresses?

If so it may be possible to fix it.

Paul.


>> Can you check out whether the statement could be added to the BB "Direct vs. non-direct buffer" sections.
> 
> Sure.
> 
> Brian

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


More information about the nio-dev mailing list