szetszwo commented on pull request #388: URL: https://github.com/apache/incubator-ratis/pull/388#issuecomment-752811602
@runzhiwang , thanks a lot for testing it. ``` - .setBuffer(decodeData(buf, header, b -> b.copy().nioBuffer())) + .setBuffer(decodeData(buf, header, NettyDataStreamUtils::copy)) ``` The original code uses Netty ByteBuf.copy(). It allocates a ByteBuf object from its buffer pool and the object needs to be released afterward. Otherwise, there is a leak. The new code copies the ByteBuf by creating a new byte[]. Of course, Java will gc it afterward as usual. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected]
