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_r334223099
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/memory/MemoryManager.java
##########
@@ -402,29 +386,25 @@ public void releaseAll(Object owner) {
return;
}
- // -------------------- BEGIN CRITICAL SECTION
-------------------
- synchronized (lock) {
- if (isShutDown) {
- throw new IllegalStateException("Memory manager
has been shut down.");
- }
+ Preconditions.checkState(!isShutDown, "Memory manager has been
shut down.");
- // get all segments
- final Set<MemorySegment> segments =
allocatedSegments.remove(owner);
+ // get all segments
+ Set<MemorySegment> segments = allocatedSegments.remove(owner);
- // all segments may have been freed previously
individually
- if (segments == null || segments.isEmpty()) {
- return;
- }
-
- // free each segment
- for (MemorySegment seg : segments) {
- seg.free();
- }
- numNonAllocatedPages += segments.size();
+ // all segments may have been freed previously individually
+ if (segments == null || segments.isEmpty()) {
+ return;
+ }
- segments.clear();
+ // free each segment
+ EnumMap<MemoryType, Long> releasedMemory = new
EnumMap<>(MemoryType.class);
+ for (MemorySegment segment : segments) {
+ segment.free();
Review comment:
True, this comment is out of sync.
----------------------------------------------------------------
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