tillrohrmann commented on a change in pull request #11109: 
[FLINK-15758][MemManager] Release segment and its unsafe memory in GC Cleaner
URL: https://github.com/apache/flink/pull/11109#discussion_r410243332
 
 

 ##########
 File path: 
flink-core/src/main/java/org/apache/flink/core/memory/MemorySegmentFactory.java
 ##########
 @@ -95,7 +96,12 @@ public static MemorySegment 
allocateUnpooledOffHeapMemory(int size) {
         */
        public static MemorySegment allocateUnpooledOffHeapMemory(int size, 
Object owner) {
                ByteBuffer memory = ByteBuffer.allocateDirect(size);
-               return new HybridMemorySegment(memory, owner, null);
+               return new HybridMemorySegment(memory, owner);
+       }
+
+       @VisibleForTesting
+       public static MemorySegment allocateOffHeapUnsafeMemory(int size) {
+               return allocateOffHeapUnsafeMemory(size, null, () -> {});
 
 Review comment:
   Not sure but won't this call create a new anonymous class for the lambda for 
every call? What about creating one `static final Runnable NO_OP = () -> {};` 
which is used here.

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


With regards,
Apache Git Services

Reply via email to