code: public ListenableFuture<?> reserve(QueryId queryId, String allocationTag, long bytes)
      {
          checkArgument(bytes >= 0, "bytes is negative");
  
          ListenableFuture<?> result;
          synchronized (this) {
              if (bytes != 0) {
                  queryMemoryReservations.merge(queryId, bytes, Long::sum);
                  updateTaggedMemoryAllocations(queryId, allocationTag, bytes);
              }
              reservedBytes += bytes;
              if (getFreeBytes() <= 0) {
                  if (future == null) {
                      future = NonCancellableMemoryFuture.create();
                  }
                  checkState(!future.isDone(), "future is already completed");
                  result = future;
              }
              else {
                  result = NOT_BLOCKED;
              }
          }
  
          onMemoryReserved();
          return result;
      }
docs: Reserves the given number of bytes. Caller should wait on the returned future, before allocating more memory.