示例#1
0
 private void shutdownMemoryManager() throws Exception {
   if (this.memorySize > 0) {
     MemoryManager memMan = this.mockEnv.getMemoryManager();
     if (memMan != null) {
       Assert.assertTrue(
           "Memory Manager managed memory was not completely freed.", memMan.verifyEmpty());
       memMan.shutdown();
     }
   }
 }
 public SpillingResettableIterator(
     Iterator<T> input,
     TypeSerializer<T> serializer,
     MemoryManager memoryManager,
     IOManager ioManager,
     int numPages,
     AbstractInvokable parentTask)
     throws MemoryAllocationException {
   this(
       input,
       serializer,
       memoryManager,
       ioManager,
       memoryManager.allocatePages(parentTask, numPages),
       true);
 }
  private SpillingResettableIterator(
      Iterator<T> input,
      TypeSerializer<T> serializer,
      MemoryManager memoryManager,
      IOManager ioManager,
      List<MemorySegment> memory,
      boolean releaseMemOnClose) {
    this.memoryManager = memoryManager;
    this.input = input;
    this.instance = serializer.createInstance();
    this.serializer = serializer;
    this.memorySegments = memory;
    this.releaseMemoryOnClose = releaseMemOnClose;

    if (LOG.isDebugEnabled()) {
      LOG.debug(
          "Creating spilling resettable iterator with " + memory.size() + " pages of memory.");
    }

    this.buffer =
        new SpillingBuffer(
            ioManager, new ListMemorySegmentSource(memory), memoryManager.getPageSize());
  }