code: synchronized Long getMemReservedForTasks(
        TaskTrackerStatus taskTracker, TaskType taskType) {
      long vmem = 0;
  
      for (TaskStatus task : taskTracker.getTaskReports()) {
        // the following task states are one in which the slot is
        // still occupied and hence memory of the task should be
        // accounted in used memory.
        if ((task.getRunState() == TaskStatus.State.RUNNING) ||
            (task.getRunState() == TaskStatus.State.UNASSIGNED) ||
            (task.inTaskCleanupPhase())) {
          // Get the memory "allotted" for this task based on number of slots
          long myVmem = 0;
          if (task.getIsMap() && taskType == TaskType.MAP) {
            long memSizePerMapSlot = scheduler.getMemSizeForMapSlot(); 
            myVmem = 
              memSizePerMapSlot * task.getNumSlots();
          } else if (!task.getIsMap()
              && taskType == TaskType.REDUCE) {
            long memSizePerReduceSlot = scheduler.getMemSizeForReduceSlot(); 
            myVmem = memSizePerReduceSlot * task.getNumSlots();
          }
          vmem += myVmem;
        }
      }
  
      return Long.valueOf(vmem);
    }
docs: Find the memory that is already used by all the running tasks
  residing on the given TaskTracker.
  
  @param taskTracker
  @param taskType
  @return amount of memory that is used by the residing tasks,
  null if memory cannot be computed for some reason.