public static MemoryUsage safeGetHeapMemoryUsage() {
    MemoryUsage usage = null;
    try {
      usage = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
    } catch (RuntimeException exception) {
      LOG.warn(JVM_HEAP_EXCEPTION, exception);
    }
    return usage;
  }
Return JVM memory statistics while properly handling runtime exceptions from the JVM.
@return a memory usage object, null if there was a runtime exception. (n.b. you could also get
        -1 values back from the JVM)
@see MemoryUsage
hbase-server/src/main/java/org/apache/hadoop/hbase/io/util/MemorySizeUtil.java