Any insight on this much appreciated.
On Thu, May 21, 2020 at 12:08 AM Priyanka Perera <[email protected]> wrote:
> Hi,
>
> It appears that with *openjdk-11.0.3* the *Unpooled.buffer()* may return
> a *ByteBuf *with a backing array elements initialized to non zero values.
>
> In Oracle JDK 8 however, the elements of the backing array are initialized
> to zero.
>
> Using *netty-4.1.41.Final*.
>
> Appreciate if this can be explained.
>
> Is there an API to get a ByteBuf with backing array elements initialized
> to zero ?.
>
> @Test(invocationCount = 10000)
> public void testInitialization() {
> final int SIZE = 10000;
> ByteBuf byteBuf = Unpooled.buffer(SIZE);
>
> int arrayLength = byteBuf.array().length;
> for (int arrayIndex = 0; arrayIndex < arrayLength; arrayIndex++) {
> Assert.assertEquals(byteBuf.array()[arrayIndex], 0);
> }
> }
>
>
> [image: image.png]
>
--
You received this message because you are subscribed to the Google Groups
"Netty discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/netty/CAJt14FMF6D%3DcQnb643e7kF6RTQXw2%3Dp%2BjF6ardEDsVDpQa29bQ%40mail.gmail.com.