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 my*MessageSizeEstimator 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.
>>
>> [image: netty1.jpg]
>>
>>
>> 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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/netty/81f1e04a-22f8-42a7-b8c4-50763b5062cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to