chia7712 commented on code in PR #21065:
URL: https://github.com/apache/kafka/pull/21065#discussion_r2658830393
##########
clients/src/main/java/org/apache/kafka/clients/producer/internals/BufferPool.java:
##########
@@ -274,6 +274,17 @@ public void deallocate(ByteBuffer buffer, int size) {
}
}
+ /**
+ * buffer is passed in only for use in tests
+ */
+ public void deallocateWithoutReuse(ByteBuffer buffer, int size) {
+ // We pass in a fresh buffer to be deallocated (added back to the pool
if it is a poolable size)
+ // This is slightly inefficient if it's not a poolable size, but those
tend to be small and
+ // this code is not hit often anyway
+ // This is useful if we're not 100% sure the buffer is not in use,
which happens in some error cases
+ deallocate(ByteBuffer.allocate(size));
Review Comment:
@junrao's comment
(https://github.com/apache/kafka/pull/21065#discussion_r2658498977) captures
exactly what I was trying to explain 😀
--
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]