rkhachatryan commented on a change in pull request #12120: URL: https://github.com/apache/flink/pull/12120#discussion_r426612454
########## 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 think you are right, these ownership rules are more clear (though implementation will be a bit more complex and less optimal in collections iterators). I'll update the PR. ---------------------------------------------------------------- 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: us...@infra.apache.org