xintongsong commented on a change in pull request #14904: URL: https://github.com/apache/flink/pull/14904#discussion_r575746460
########## File path: flink-core/src/main/java/org/apache/flink/core/memory/HybridMemorySegment.java ########## @@ -94,26 +126,22 @@ @Override public void free() { super.free(); + if (cleaner != null) { + cleaner.run(); + } Review comment: `HybridMemorySegment` is currently the only `MemorySegment` implementation that is used in production. `HeapMemorySegment` is no longer used, but seems intentionally not removed as it is annotated with `@SuppressWarnings("unused")`. From my side, it makes sense to split `HybridMemorySegment` into `HeapMemorySegment`, `DirectMemorySegment` and `UnsafeMemorySegment`. This should get rid of lots of `if-else` branches in the implementation. I'm leaning towards addressing this refactor as a follow-up effort, and only do that for the master branch. ---------------------------------------------------------------- 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