code: public void showMemoryUsage() {
      logger.info("Memory used in task " + taskAttemptId);
      synchronized (this) {
        long memoryAccountedForByConsumers = 0;
        for (MemoryConsumer c: consumers) {
          long totalMemUsage = c.getUsed();
          memoryAccountedForByConsumers += totalMemUsage;
          if (totalMemUsage > 0) {
            logger.info("Acquired by " + c + ": " + Utils.bytesToString(totalMemUsage));
          }
        }
        long memoryNotAccountedFor =
          memoryManager.getExecutionMemoryUsageForTask(taskAttemptId) - memoryAccountedForByConsumers;
        logger.info(
          "{} bytes of memory were used by task {} but are not associated with specific consumers",
          memoryNotAccountedFor, taskAttemptId);
        logger.info(
          "{} bytes of memory are used for execution and {} bytes of memory are used for storage",
          memoryManager.executionMemoryUsed(), memoryManager.storageMemoryUsed());
      }
    }
docs: Dump the memory usage of all consumers.