xintongsong commented on a change in pull request #9693: [FLINK-13984] Separate 
on-heap and off-heap managed memory pools
URL: https://github.com/apache/flink/pull/9693#discussion_r327915668
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/memory/MemoryManager.java
 ##########
 @@ -300,31 +255,21 @@ public void allocatePages(Object owner, 
List<MemorySegment> target, int numPages
                                allocatedSegments.put(owner, segmentsForOwner);
                        }
 
-                       if (isPreAllocated) {
-                               for (int i = numPages; i > 0; i--) {
-                                       MemorySegment segment = 
memoryPool.requestSegmentFromPool(owner);
-                                       target.add(segment);
-                                       segmentsForOwner.add(segment);
-                               }
-                       }
-                       else {
-                               for (int i = numPages; i > 0; i--) {
-                                       MemorySegment segment = 
memoryPool.allocateNewSegment(owner);
-                                       target.add(segment);
-                                       segmentsForOwner.add(segment);
-                               }
-                               numNonAllocatedPages -= numPages;
+                       for (int i = numPages; i > 0; i--) {
+                               MemorySegment segment = 
allocateManagedSegment(memoryType, owner);
+                               target.add(segment);
+                               segmentsForOwner.add(segment);
                        }
+                       numNonAllocatedPages -= numPages;
                }
                // -------------------- END CRITICAL SECTION -------------------
        }
 
        /**
-        * Tries to release the memory for the specified segment. If the 
segment has already been released or
-        * is null, the request is simply ignored.
+        * Tries to release the memory for the specified segment.
         *
-        * <p>If the memory manager manages pre-allocated memory, the memory 
segment goes back to the memory pool.
-        * Otherwise, the segment is only freed and made eligible for 
reclamation by the GC.
+        * <p>If the segment has already been released or is null, the request 
is simply ignored.
 
 Review comment:
   remove 'If'

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


With regards,
Apache Git Services

Reply via email to