code: public static boolean tryReserveTaskMem(long m){
      if(!CAN_ALLOC)return false;
      if( m == 0 ) return true;
      assert m >= 0:"m < 0: " + m;
      long current = _taskMem.addAndGet(-m);
      if(current < 0){
        _taskMem.addAndGet(m);
        return false;
      }
      return true;
    }
docs: Try to reserve memory needed for task execution and return true if
  succeeded.  Tasks have a shared pool of memory which they should ask for
  in advance before they even try to allocate it.
  
  This method is another backpressure mechanism to make sure we do not
  exhaust system's resources by running too many tasks at the same time.
  Tasks are expected to reserve memory before proceeding with their
  execution and making sure they release it when done.
  
  @param m - requested number of bytes
  @return true if there is enough free memory