akalash commented on code in PR #22447:
URL: https://github.com/apache/flink/pull/22447#discussion_r1185009999


##########
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/LocalBufferPool.java:
##########
@@ -460,17 +454,25 @@ private boolean requestMemorySegmentFromGlobal() {
     private MemorySegment requestOverdraftMemorySegmentFromGlobal() {
         assert Thread.holdsLock(availableMemorySegments);
 
-        if (numberOfRequestedOverdraftMemorySegments >= 
maxOverdraftBuffersPerGate) {
+        // if overdraft buffers(i.e. buffers exceeding poolSize) is greater 
than or equal to
+        // maxOverdraftBuffersPerGate, no new buffer can be requested.
+        if (numberOfRequestedMemorySegments - currentPoolSize >= 
maxOverdraftBuffersPerGate) {
             return null;
         }
 
         checkState(
                 !isDestroyed,
                 "Destroyed buffer pools should never acquire segments - this 
will lead to buffer leaks.");

Review Comment:
   I think you can move `checkState` to your newly created method 
`requestPooledMemorySegment` as well



-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to