mat解决oom一般方法实践

1 mac安装mat

--data 可写路径

/**
 * https://www.cnblogs.com/silyvin/p/12640045.html
 */
public class MAT {

    // -Xmx100m -XX:+PrintGCDetails -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/Users/joyce/Downloads/tmp
    public static void main(String[] args){

        // 混淆导致oom代码,看mat是否看得出
        byte[] holder = new byte[32*1024*1024];

        List<String> list = new ArrayList<String>();
        while(true){
            list.add("1234567890");
        }
    }
}

 3 mat

4 visualvm并未定位到堆栈

5

链接: https://pan.baidu.com/s/1TbiZjzi3P1GRDWqjvPKYfw 提取码: cqb6 

原文地址:https://www.cnblogs.com/silyvin/p/12640045.html