public static List<String> memoryUsage() throws Exception {
        final MemoryUsage heapMemoryUsage = MXBeanHolder.memoryMxBean.getHeapMemoryUsage();
        final MemoryUsage nonHeapMemoryUsage = MXBeanHolder.memoryMxBean.getNonHeapMemoryUsage();

        final List<String> memoryUsageList = new LinkedList<>();
        memoryUsageList.add("********************************** Memory Usage **********************************"
                            + Constants.NEWLINE);
        memoryUsageList.add("Heap Memory Usage: " + heapMemoryUsage.toString() + Constants.NEWLINE);
        memoryUsageList.add("NonHeap Memory Usage: " + nonHeapMemoryUsage.toString() + Constants.NEWLINE);

        return memoryUsageList;
    }
Returns memory usage for the current java process.
jraft-rheakv/rheakv-core/src/main/java/com/alipay/sofa/jraft/rhea/util/JvmTools.java