Netty 4.20 PooledByteBufAllocator

87 views
Skip to first unread message

Kevin Visscher

unread,
Jun 28, 2014, 3:27:51 PM6/28/14
to ne...@googlegroups.com
Hello,

I have a question regarding the PooledByteBufAllocator in Netty 4.20. Is it stable enough to use in a production environment? And am I responsible for releasing the buffers? Or does Netty handle that part when the buffers are flushed or used for incoming messages in my ByteToMessageDecoder?

Kinds regards,
Kevin

Norman Maurer

unread,
Jun 30, 2014, 12:53:29 AM6/30/14
to ne...@googlegroups.com, Kevin Visscher
Hey Kevin,

yes the PooledByteBufAllocator is production-ready and will be the default allocator from 4.1.0 on. 

Regarding the release of ByteBufs read:

Hope it helps!

-- 
Norman Maurer

JBoss, by Red Hat

--

---
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 netty+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kevin Visscher

unread,
Jun 30, 2014, 2:08:23 AM6/30/14
to ne...@googlegroups.com, tensi...@gmail.com
Hi Norman,

Thanks for the reply. The article made it clear :).

I have another question though, what if I would change my implementation to work with the pooled buffers. So I will be calling release on them afterwards. I now decide to switch back to unpooled buffers, does this mean I have to remove calls to release again? Or this there something hidden in Netty that allows me to keep my code base that works with the pooled buffers?

Norman Maurer

unread,
Jun 30, 2014, 2:24:58 AM6/30/14
to ne...@googlegroups.com, Kevin Visscher, tensi...@gmail.com
The code should be exactly the same and work with both :)

-- 
Norman Maurer

JBoss, by Red Hat


Kevin Visscher

unread,
Jun 30, 2014, 3:56:48 AM6/30/14
to ne...@googlegroups.com, tensi...@gmail.com
That's awesome :).

I seem to have a small problem now that I'm calling release in my ByteToMessageDecoder (releasing to often). Am I not required to call release on the incoming buffer in a ByteToMessageDecoder? Because I saw in the source code that the data and cumulation buffers are released?

Norman Maurer

unread,
Jun 30, 2014, 4:45:15 AM6/30/14
to ne...@googlegroups.com, Kevin Visscher, tensi...@gmail.com
Hi Kevin,

yeah the *Decoder and *Encoder classes call release by themselves as this is what most users need. This is also stated in the javadocs there :)

-- 
Norman Maurer

JBoss, by Red Hat


Kevin Visscher

unread,
Jun 30, 2014, 4:46:22 AM6/30/14
to ne...@googlegroups.com, tensi...@gmail.com
Thanks for the fast replies. Loving the project!

Asaf Mesika

unread,
Feb 23, 2019, 3:08:55 PM2/23/19
to Netty discussions
Sorry to wake up this old thread.
I'm looking at the javadoc of ByteToMessageDecoder and I'm not seeing any line saying - "don't release the ByteBuf your selfs".
Am I missing something?

Norman Maurer

unread,
Feb 27, 2019, 6:24:57 AM2/27/19
to ne...@googlegroups.com
You are right… We should add it. If you want you can also do a PR :)

Bye
Norman


--
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 netty+un...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages