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_r333814167
##########
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:
My bad, please ignore this comment.
I think I found some kind of typo with an extra 'if' in the doc/comment when
I reviewed this PR locally in my IDE. But I cannot find it now. I probably have
left this comment at wrong place when moving from IDE to GitHub.
----------------------------------------------------------------
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