点击你的 Java 项目 / 类 → 选择Run As→ 选择Run Configurations点击 Eclipse 顶部菜单栏的Run→Run Configurations在VM arguments(VM 参数)输入框中,添加以下参数-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=c:/heapdump.hprof