code: boolean isProcessTreeOverLimit(String tId, 
                                    long currentMemUsage, 
                                    long curMemUsageOfAgedProcesses, 
                                    long limit) {
      boolean isOverLimit = false;
      
      if (currentMemUsage > (2*limit)) {
        LOG.warn("Process tree for task: " + tId + " running over twice " +
                  "the configured limit. Limit=" + limit + 
                  ", current usage = " + currentMemUsage);
        isOverLimit = true;
      } else if (curMemUsageOfAgedProcesses > limit) {
        LOG.warn("Process tree for task: " + tId + " has processes older than 1 " +
            "iteration running over the configured limit. Limit=" + limit + 
            ", current usage = " + curMemUsageOfAgedProcesses);
        isOverLimit = true;
      }
  
      return isOverLimit; 
    }
docs: Check whether a task's process tree's current memory usage is over limit.
  
  When a java process exec's a program, it could momentarily account for
  double the size of it's memory, because the JVM does a fork()+exec()
  which at fork time creates a copy of the parent's memory. If the
  monitoring thread detects the memory used by the task tree at the same
  instance, it could assume it is over limit and kill the tree, for no
  fault of the process itself.
  
  We counter this problem by employing a heuristic check:
  - if a process tree exceeds the memory limit by more than twice,
  it is killed immediately
  - if a process tree has processes older than the monitoring interval
  exceeding the memory limit by even 1 time, it is killed. Else it is given
  the benefit of doubt to lie around for one more iteration.
  
  @param tId Task Id for the task tree
  @param currentMemUsage Memory usage of a task tree
  @param curMemUsageOfAgedProcesses Memory usage of processes older than
  an iteration in a task tree
  @param limit The limit specified for the task
  @return true if the memory usage is more than twice the specified limit,
  or if processes in the tree, older than this thread's
  monitoring interval, exceed the memory limit. False,
  otherwise.