code: synchronized void addWriter(final Path path,
                                final long requestedAllocation,
                                final Callback callback,
                                final long initialAllocation) throws IOException {
      WriterInfo oldVal = writerList.get(path);
      // this should always be null, but we handle the case where the memory
      // manager wasn't told that a writer wasn't still in use and the task
      // starts writing to the same path.
      if (oldVal == null) {
        LOG.info("Registering writer for path " + path.toString());
        oldVal = new WriterInfo(requestedAllocation, callback);
        writerList.put(path, oldVal);
        totalAllocation += requestedAllocation;
      } else {
        // handle a new writer that is writing to the same path
        totalAllocation += requestedAllocation - oldVal.allocation;
        oldVal.setAllocation(requestedAllocation);
        oldVal.setCallback(callback);
      }
      updateScale(true);
  
      // If we're not already in low memory mode, and the initial allocation already exceeds the
      // allocation, enter low memory mode to try to avoid an OOM
      if (!lowMemoryMode && requestedAllocation * currentScale <= initialAllocation) {
        lowMemoryMode = true;
        LOG.info("ORC: Switching to low memory mode");
        for (WriterInfo writer : writerList.values()) {
          writer.callback.enterLowMemoryMode();
        }
      }
    }
docs: Add a new writer's memory allocation to the pool. We use the path
  as a unique key to ensure that we don't get duplicates.
  @param path the file that is being written
  @param requestedAllocation the requested buffer size
  @param initialAllocation the current size of the buffer