Memory Analyzer Tool: ParseHeapDump.sh - Application Error: OutOfMemory Requested length of new long[2,147,483,640] exceeds limit of 2,147,483,639
Memory Analyzer Tool: ParseHeapDump.sh - Application Error: OutOfMemory Requested length of new long[2,147,483,640] exceeds limit of 2,147,483,639
我正在尝试分析远程计算机上的 200GB heapdump。堆转储是通过 visualVMs "Create Heap Dump" 按钮创建的。即使使用 Xmx300GB ("$(dirname -- "[=11=]")"/MemoryAnalyzer -consolelog -application org.eclipse.mat.api.parse "$@" -vmargs -Xmx300g -XX:-UseGCOverheadLimit
) 执行它也会导致 MAT 崩溃并出现以下错误:
eclipse.buildId=unknown
java.version=11.0.3
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments: -application org.eclipse.mat.api.parse ./tmp/heapdump-1577977940574.hprof
Command-line arguments: -os linux -ws gtk -arch x86_64 -consolelog -application org.eclipse.mat.api.parse ./tmp/heapdump-1577977940574.hprof
!ENTRY org.eclipse.osgi 4 0 2020-01-06 16:25:11.593
!MESSAGE Application error
!STACK 1
java.lang.OutOfMemoryError: Requested length of new long[2,147,483,640] exceeds limit of 2,147,483,639
at org.eclipse.mat.parser.index.IndexWriter$Identifier.add(IndexWriter.java:91)
at org.eclipse.mat.hprof.HprofParserHandlerImpl.reportInstance(HprofParserHandlerImpl.java:588)
at org.eclipse.mat.hprof.Pass1Parser.readPrimitiveArrayDump(Pass1Parser.java:590)
at org.eclipse.mat.hprof.Pass1Parser.readDumpSegments(Pass1Parser.java:366)
at org.eclipse.mat.hprof.Pass1Parser.read(Pass1Parser.java:175)
at org.eclipse.mat.hprof.HprofIndexBuilder.fill(HprofIndexBuilder.java:80)
at org.eclipse.mat.parser.internal.SnapshotFactoryImpl.parse(SnapshotFactoryImpl.java:222)
at org.eclipse.mat.parser.internal.SnapshotFactoryImpl.openSnapshot(SnapshotFactoryImpl.java:126)
at org.eclipse.mat.snapshot.SnapshotFactory.openSnapshot(SnapshotFactory.java:145)
at org.eclipse.mat.internal.apps.ParseSnapshotApp.parse(ParseSnapshotApp.java:134)
at org.eclipse.mat.internal.apps.ParseSnapshotApp.start(ParseSnapshotApp.java:106)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:656)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:592)
at org.eclipse.equinox.launcher.Main.run(Main.java:1498)
at org.eclipse.equinox.launcher.Main.main(Main.java:1471)
文件是否已损坏,或者它太大而无法分析?
根据 this comment,您很可能遇到了内存分析器的已知限制:
"Memory Analyzer has an architectural limit of 2^31 - 3 objects, a current limit of 2^31 - 8 = 2,147,483,640 objects, but has not been tested with that many objects. The current record is a heap dump file of 48Gbytes containing 948,000,000 objects, which was opened with Memory Analyzer running with a 58Gbyte heap."
See also https://dev.eclipse.org/mhonarc/lists//mat-dev/msg00324.html
无论堆大小有多大Java 都不允许创建大于Integer.MAX_VALUE - 5
which is 2,147,483,639 的数组。
您可以尝试下载最新版本的 Memory Analyzer,看看限制是否有所改善。
Eclipse Memory Analyzer 的最新快照版本具有随机丢弃一定比例的对象以减少内存消耗并允许分析剩余对象的功能。请参阅 Bug 563960 - Requested length of new long[2,147,483,640] exceeds limit of 2,147,483,639 and the nightly snapshot build 以在下一版本的 MAT 中包含此工具之前对其进行测试。
来自快照构建的 MAT 内部帮助解释了如何使用这个新工具。参见 'Memory Analyzer Configuration'。
参见this answer to a similar problem: Tool for analyzing large Java heap dumps。
如果有帮助,请告诉我们。
[包含更多信息的编辑答案]
我正在尝试分析远程计算机上的 200GB heapdump。堆转储是通过 visualVMs "Create Heap Dump" 按钮创建的。即使使用 Xmx300GB ("$(dirname -- "[=11=]")"/MemoryAnalyzer -consolelog -application org.eclipse.mat.api.parse "$@" -vmargs -Xmx300g -XX:-UseGCOverheadLimit
) 执行它也会导致 MAT 崩溃并出现以下错误:
eclipse.buildId=unknown
java.version=11.0.3
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments: -application org.eclipse.mat.api.parse ./tmp/heapdump-1577977940574.hprof
Command-line arguments: -os linux -ws gtk -arch x86_64 -consolelog -application org.eclipse.mat.api.parse ./tmp/heapdump-1577977940574.hprof
!ENTRY org.eclipse.osgi 4 0 2020-01-06 16:25:11.593
!MESSAGE Application error
!STACK 1
java.lang.OutOfMemoryError: Requested length of new long[2,147,483,640] exceeds limit of 2,147,483,639
at org.eclipse.mat.parser.index.IndexWriter$Identifier.add(IndexWriter.java:91)
at org.eclipse.mat.hprof.HprofParserHandlerImpl.reportInstance(HprofParserHandlerImpl.java:588)
at org.eclipse.mat.hprof.Pass1Parser.readPrimitiveArrayDump(Pass1Parser.java:590)
at org.eclipse.mat.hprof.Pass1Parser.readDumpSegments(Pass1Parser.java:366)
at org.eclipse.mat.hprof.Pass1Parser.read(Pass1Parser.java:175)
at org.eclipse.mat.hprof.HprofIndexBuilder.fill(HprofIndexBuilder.java:80)
at org.eclipse.mat.parser.internal.SnapshotFactoryImpl.parse(SnapshotFactoryImpl.java:222)
at org.eclipse.mat.parser.internal.SnapshotFactoryImpl.openSnapshot(SnapshotFactoryImpl.java:126)
at org.eclipse.mat.snapshot.SnapshotFactory.openSnapshot(SnapshotFactory.java:145)
at org.eclipse.mat.internal.apps.ParseSnapshotApp.parse(ParseSnapshotApp.java:134)
at org.eclipse.mat.internal.apps.ParseSnapshotApp.start(ParseSnapshotApp.java:106)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:656)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:592)
at org.eclipse.equinox.launcher.Main.run(Main.java:1498)
at org.eclipse.equinox.launcher.Main.main(Main.java:1471)
文件是否已损坏,或者它太大而无法分析?
根据 this comment,您很可能遇到了内存分析器的已知限制:
"Memory Analyzer has an architectural limit of 2^31 - 3 objects, a current limit of 2^31 - 8 = 2,147,483,640 objects, but has not been tested with that many objects. The current record is a heap dump file of 48Gbytes containing 948,000,000 objects, which was opened with Memory Analyzer running with a 58Gbyte heap."
See also https://dev.eclipse.org/mhonarc/lists//mat-dev/msg00324.html
无论堆大小有多大Java 都不允许创建大于Integer.MAX_VALUE - 5
which is 2,147,483,639 的数组。
您可以尝试下载最新版本的 Memory Analyzer,看看限制是否有所改善。
Eclipse Memory Analyzer 的最新快照版本具有随机丢弃一定比例的对象以减少内存消耗并允许分析剩余对象的功能。请参阅 Bug 563960 - Requested length of new long[2,147,483,640] exceeds limit of 2,147,483,639 and the nightly snapshot build 以在下一版本的 MAT 中包含此工具之前对其进行测试。
来自快照构建的 MAT 内部帮助解释了如何使用这个新工具。参见 'Memory Analyzer Configuration'。
参见this answer to a similar problem: Tool for analyzing large Java heap dumps。
如果有帮助,请告诉我们。
[包含更多信息的编辑答案]