rkhachatryan commented on a change in pull request #12120:
URL: https://github.com/apache/flink/pull/12120#discussion_r426139079



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/disk/FileBasedBufferIterator.java
##########
@@ -85,6 +90,6 @@ private int read(byte[] buffer) {
 
        @Override
        public void close() throws Exception {
-               closeAll(stream, file::release);
+               closeAll(stream, file::release, () -> 
buffersToClose.forEach(Buffer::recycleBuffer));

Review comment:
       I've changed it to recycle only the last buffer in `close`.
   I wanted to avoid extra complexity but it turned out not that complicated.
   
   (the reason why buffers need to be recycled by iterator rather than by 
client is that for in-memory collections we always want to recycle all the 
elements, even if iteration wasn't started)




----------------------------------------------------------------
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]


Reply via email to