peterxcli commented on code in PR #1481:
URL: https://github.com/apache/ratis/pull/1481#discussion_r3440929024


##########
ratis-common/src/main/java/org/apache/ratis/datastream/impl/DataStreamReplyByteBuf.java:
##########
@@ -118,4 +118,10 @@ static ByteBuffer copy(ByteBuf buf) {
     buf.readBytes(bytes);
     return ByteBuffer.wrap(bytes);
   }
+
+  public static void release(DataStreamReply reply) {
+    if (reply instanceof DataStreamReplyByteBuf) {
+      ((DataStreamReplyByteBuf) reply).release();
+    }

Review Comment:
   There are two classes implement the `DataStreamReply`, which is 
`DataStreamReplyByteBuf` and `DataStreamReplyByteBuffer`.
   And only `DataStreamReplyByteBuf` need to release the Netty byteBuffer 
reference count
   
   
https://github.com/apache/ratis/blob/3cb6794bcb9fcd35dfd8bd67a885a70cc9de7a56/ratis-common/src/main/java/org/apache/ratis/datastream/impl/DataStreamPacketByteBuf.java#L58-L63



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to