本文整理汇总了Java中org.apache.flink.core.memory.MemorySegment.isFreed方法的典型用法代码示例。如果您正苦于以下问题:Java MemorySegment.isFreed方法的具体用法?Java MemorySegment.isFreed怎么用?Java MemorySegment.isFreed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.flink.core.memory.MemorySegment
的用法示例。
在下文中一共展示了MemorySegment.isFreed方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: allMemorySegmentsValid
import org.apache.flink.core.memory.MemorySegment; //导入方法依赖的package包/类
private boolean allMemorySegmentsValid(List<MemorySegment> memSegs) {
for (MemorySegment seg : memSegs) {
if (seg.isFreed()) {
return false;
}
}
return true;
}
示例2: allMemorySegmentsFreed
import org.apache.flink.core.memory.MemorySegment; //导入方法依赖的package包/类
private boolean allMemorySegmentsFreed(List<MemorySegment> memSegs) {
for (MemorySegment seg : memSegs) {
if (!seg.isFreed()) {
return false;
}
}
return true;
}
示例3: release
import org.apache.flink.core.memory.MemorySegment; //导入方法依赖的package包/类
/**
* Tries to release the memory for the specified segment. If the segment has already been released or
* is null, the request is simply ignored.
*
* <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.
*
* @param segment The segment to be released.
* @throws IllegalArgumentException Thrown, if the given segment is of an incompatible type.
*/
public void release(MemorySegment segment) {
// check if segment is null or has already been freed
if (segment == null || segment.getOwner() == null) {
return;
}
final Object owner = segment.getOwner();
// -------------------- BEGIN CRITICAL SECTION -------------------
synchronized (lock) {
// prevent double return to this memory manager
if (segment.isFreed()) {
return;
}
if (isShutDown) {
throw new IllegalStateException("Memory manager has been shut down.");
}
// remove the reference in the map for the owner
try {
Set<MemorySegment> segsForOwner = this.allocatedSegments.get(owner);
if (segsForOwner != null) {
segsForOwner.remove(segment);
if (segsForOwner.isEmpty()) {
this.allocatedSegments.remove(owner);
}
}
if (isPreAllocated) {
// release the memory in any case
memoryPool.returnSegmentToPool(segment);
}
else {
segment.free();
numNonAllocatedPages++;
}
}
catch (Throwable t) {
throw new RuntimeException("Error removing book-keeping reference to allocated memory segment.", t);
}
}
// -------------------- END CRITICAL SECTION -------------------
}