doc[protocol]: readRetainedSlice和byte[]数组相比,readRetainedSlice减少了垃圾回收

This commit is contained in:
jaysunxiao
2022-06-10 17:12:28 +08:00
parent 03c742feb8
commit e577e8e71e
@@ -62,6 +62,7 @@ public class TcpCodecHandler extends ByteToMessageCodec<EncodedPacketInfo> {
ByteBuf tmpByteBuf = null;
try {
// readRetainedSlice和byte[]数组相比,readRetainedSlice减少了垃圾回收
tmpByteBuf = in.readRetainedSlice(length);
DecodedPacketInfo packetInfo = NetContext.getPacketService().read(tmpByteBuf);
out.add(packetInfo);