xintongsong commented on a change in pull request #15224:
URL: https://github.com/apache/flink/pull/15224#discussion_r594842999



##########
File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/memory/MemoryManagerTest.java
##########
@@ -351,4 +352,27 @@ private void testCannotReserveAnymore(long size) {
             // expected
         }
     }
+
+    private UnsafeMemoryBudget allocateLeakingPages() throws 
MemoryAllocationException {

Review comment:
       The method name does not matches what it does. Maybe 
`allocateLeakingPagesAndGetBudget`?
   
   And I'd suggest to explain in comments that we don't use 
`MemoryManagerTest#memoryManager` because we need the memory manager to be 
phantom.

##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/memory/UnsafeMemoryBudget.java
##########
@@ -213,4 +213,16 @@ void releaseMemory(@Nonnegative long size) {
                             size, currentAvailableMemorySize, 
totalMemorySize));
         }
     }
+
+    /**
+     * Return an runnable to postpone memory release.
+     *
+     * <p>The returned runnable could be safely referenced by possible gc 
cleaner action without
+     * worrying about cycle reference back to memory manager.
+     */
+    Runnable cleanupMemory(@Nonnegative long size) {

Review comment:
       I'd suggest to call this `getReleaseMemoryAction` or 
`getCleanupMemoryAction`.
   Instead of perform an action, this method generates an action that can be 
performed later.




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