java 检查bytebuf长度_bytebuf是不是都要显示release啊 - Java技术 - Java - 水木社区

https://zhuanlan.zhihu.com/p/146474858

Bing(Reusing of bytebuf in netty):

When sharing a Netty buffer, you need to follow the rules of basic reference counting (引用计数), unlike the simple rules of basic garbage collection. 基本上:

When sending a ByteBuf away from your class, call retain()If you are done using a ByteBuf, call release()Most of the times, when you are done using a ByteBuf at the same time as sending it away, you can remove both calls.

我想(不知对否):

你的类返回个Buf,但你以后还要用它你的类不返回Buf,而且不用了,临时性Buf返回且不再用了,retain()和release都不用调

Netty文档的Reference counted objects应该细看,还有Why Netty 4 "proxy" example has to set channel "AUTO_READ" as false. OOME - Out of Memory Error/Exception.

Netty is a NIO client server framework which enables quick and easy development of network applications such as protocol servers and clients.

Rust's central feature is ownership.

Each value in Rust has a variable that's called its owner. There can only be one owner at a time. When the owner goes out of scope, the value will be dropped.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值