tillrohrmann commented on a change in pull request #13316: URL: https://github.com/apache/flink/pull/13316#discussion_r483452267
########## File path: flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/NetworkBufferPool.java ########## @@ -271,12 +271,28 @@ public int getTotalNumberOfMemorySegments() { return totalNumberOfMemorySegments; } + public long getTotalMemory() { + return getTotalNumberOfMemorySegments() * memorySegmentSize; + } + public int getNumberOfAvailableMemorySegments() { synchronized (availableMemorySegments) { return availableMemorySegments.size(); } } + public long getAvailableMemory() { + return getNumberOfAvailableMemorySegments() * memorySegmentSize; + } + + public int getNumberOfUsedMemorySegments() { + return getTotalNumberOfMemorySegments() - getNumberOfAvailableMemorySegments(); + } + + public long getUsedMemory() { + return getNumberOfUsedMemorySegments() * memorySegmentSize; + } Review comment: What is the semantic of this method? Shall it return the number of handed out memory segments to a set of `LocalBufferPools` or shall it return the size of the actually used memory? If it is the latter, then I am afraid that memory which has been handed out to the `LocalBufferPools` might also be idling there. Hence this value won't tell us how much memory is currently been used. ---------------------------------------------------------------- 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