Yes that’s the way to go 

> On 16. Apr 2019, at 17:02, you fu <[email protected]> wrote:
> 
> I read the source code and debug it .
> 
> find DefaultMessageSizeEstimator size method  
> 
> public int size(Object msg) {
>     if (msg instanceof ByteBuf) {
>         return ((ByteBuf)msg).readableBytes();
>     } else if (msg instanceof ByteBufHolder) {
>         return ((ByteBufHolder)msg).content().readableBytes();
>     } else {
>         return msg instanceof FileRegion ? 0 : this.unknownSize;
>     }
> }
> 
> 
> if msg is my customize msg ,the size is only 8 .
> 
> so I read the code ,and  channel config ChannelOption.MESSAGE_SIZE_ESTIMATOR,
> I implement myMessageSizeEstimator use code config  
>   .childOption(ChannelOption.MESSAGE_SIZE_ESTIMATOR, 
> MyDefaultMessageSizeEstimator.DEFAULT)
> 
> is it right?
> 
> On Sunday, April 14, 2019 at 6:54:21 PM UTC+8, you fu wrote:
> the Netty veriosn is 4.0.42.Final 
> 
> 
> 
> On Sunday, April 14, 2019 at 6:52:47 PM UTC+8, you fu wrote:
> Hi , When my application occur OutOfDirectMemoryError, dump JVM memory 
> profile.
> 
> the io.netty.channel.ChannelOutboundBuffer instance  totalPendingSize  is  
> 13,864,807,239 , and unwritable is 1.
> 
> 
> 
> 
> the server code is 
>           .childOption(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK, 67108864)  
> //16MB
>           .childOption(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK, 1048576) 
> //1M 
> 
> why the totalPendingSize can increase to  13,864,807,239?
> 
> 
> 
> -- 
> 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] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/netty/81f1e04a-22f8-42a7-b8c4-50763b5062cd%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/netty/81f1e04a-22f8-42a7-b8c4-50763b5062cd%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
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/7533149E-9E27-446C-9FC9-8F06D55247F0%40googlemail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to