Java Eclipse Memory Analyser,但总是显示发生内部错误?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9819905/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Eclipse Memory Analyser,but always shows An internal error occurred?
提问by Gavin
java.lang.OutOfMemoryError: Java heap space
Dumping heap to java_pid2584.hprof ...
Heap dump file created [106948719 bytes in 4.213 secs]
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2760)
at java.util.Arrays.copyOf(Arrays.java:2734)
at java.util.ArrayList.ensureCapacity(ArrayList.java:167)
at java.util.ArrayList.add(ArrayList.java:351)
at Main.main(Main.java:15)
But when i open head dump java_pid2584.hprof via Eclipse Memory Analyser,but there is always message:
但是当我通过 Eclipse Memory Analyser 打开 head dump java_pid2584.hprof 时,但总是有消息:
An internal error occurred during:
"Parsing heap dump from **\java_pid6564.hprof'".Java heap space
回答by wojand
You may reduce your application memory limit, and then again take a dump. Eclipse Memory Analyser puts dump file to memory - I suspect that your Eclipse has less memory than the limit of application.
您可以减少应用程序内存限制,然后再次进行转储。Eclipse Memory Analyzer 将转储文件放入内存 - 我怀疑您的 Eclipse 的内存少于应用程序的限制。
You can also do the opposite and increase the memory limit for Eclipse, but if your application works on a server, it will be hard to match in size of memory.
您也可以反其道而行之,增加 Eclipse 的内存限制,但如果您的应用程序在服务器上运行,则内存大小将难以匹配。
回答by codeisee
The problem is that Eclipse Memory Analyser does not have enough heap space to open the Heap dump file.
问题是 Eclipse Memory Analyzer 没有足够的堆空间来打开堆转储文件。
You can solve the problem as follows:
您可以按如下方式解决问题:
open the
MemoryAnalyzer.ini
filechange the default
-Xmx1024m
to a larger size
打开
MemoryAnalyzer.ini
文件将默认值更改
-Xmx1024m
为更大的尺寸
回答by Hemang Rami
An internal error has occurred. Java heap space
发生内部错误。Java堆空间
Ans: GO to Your Project Work space open .setting folder Delete all file of .setting folder. after you can compile now there is no error Like Heap space Enjoy :)
Ans:转到您的项目工作空间,打开 .setting 文件夹删除 .setting 文件夹中的所有文件。现在可以编译后没有错误喜欢堆空间享受:)
回答by mibrahim
I tried all the solutions here as well, while still getting the same error and the reason eclipse was trying to open the .hprof file as a text file due to wrong or unknown file type / editor association.
我在这里也尝试了所有解决方案,但仍然遇到相同的错误,这是由于错误或未知的文件类型/编辑器关联,eclipse 试图将 .hprof 文件作为文本文件打开的原因。
Solution: Right click on the file, select open with, then select Others, and select Eclipse Memory Analyzer.
解决方法:右键文件,选择打开方式,然后选择Others,选择Eclipse Memory Analyzer。
Worked with 700MB dump, and worked with 2G dump on an eclipse heap of about 600M.
使用 700MB 转储,并在大约 600M 的 eclipse 堆上使用 2G 转储。
回答by tkincher
Note that on OS X, to increase the memory allocated to MAT, you need to right-click Memory Analyzer.app and show the package contents. The MemoryAnalyzer.ini file is under /Contents/MacOS/.
请注意,在 OS X 上,要增加分配给 MAT 的内存,您需要右键单击 Memory Analyzer.app 并显示包内容。MemoryAnalyzer.ini 文件位于 /Contents/MacOS/ 下。
回答by Goodluck
If Memory Analyser is used from Eclipse, then edit your eclipse.ini file to increase the vm argument to -Xmx1024m or higher. This worked for me. http://wiki.eclipse.org/index.php/MemoryAnalyzer/FAQ#Out_of_Memory_Error_while_Running_the_Memory_Analyzer
如果从 Eclipse 使用内存分析器,则编辑 eclipse.ini 文件以将 vm 参数增加到 -Xmx1024m 或更高。这对我有用。 http://wiki.eclipse.org/index.php/MemoryAnalyzer/FAQ#Out_of_Memory_Error_while_Running_the_Memory_Analyzer
回答by Russell Cohen
On OS X 11.5 (El Cap) modifying MemoryAnalyzer.app/Contents/MacOS/MemoryAnalyzer.ini
does not work! This is because it's looking for the MemoryAnalyzer.ini
in a different place.
在 OS X 11.5 (El Cap) 上修改MemoryAnalyzer.app/Contents/MacOS/MemoryAnalyzer.ini
不起作用!这是因为它MemoryAnalyzer.ini
在不同的地方寻找。
On my computer, it was looking for:
在我的电脑上,它正在寻找:
MemoryAnalyzer.app/Contents/Eclipse/MemoryAnalyzer.ini
but the real .ini file was:
MemoryAnalyzer.app/Contents/MacOS/MemoryAnalyzer.ini
.
MemoryAnalyzer.app/Contents/Eclipse/MemoryAnalyzer.ini
但真正的 .ini 文件是:
MemoryAnalyzer.app/Contents/MacOS/MemoryAnalyzer.ini
.
In order for your changes to take effect, copy the existing .ini
file into the new location.
为了使您的更改生效,请将现有.ini
文件复制到新位置。
To find where MemoryAnalyzer is looking for the ini file, you can run:
要查找 MemoryAnalyzer 在哪里寻找 ini 文件,您可以运行:
sudo su
cd ...MemoryAnalyzer.app/Contents/MacOS/
dtruss ./MemoryAnalyzer 2>&1 | grep ini
回答by Abhishek Garg
Solution for same issue for Memory Analyzer plugin in Eclipse in MAC OS X El Capitan.
MAC OS X El Capitan 中 Eclipse 中内存分析器插件相同问题的解决方案。
I was facing the same issue but with the eclipse plugin and I did not have any Memory Analyzer App in Applications Folder. The solution which worked for me was:
我遇到了同样的问题,但是使用 eclipse 插件并且我在应用程序文件夹中没有任何内存分析器应用程序。对我有用的解决方案是:
- Right Click on Eclipse icon and select Show Package Content.
- Go to Contents>Eclipse
- Open Eclipse.ini
- Change value -Xmx1024m to -Xmx2048m
- Restart Eclipse
- 右键单击 Eclipse 图标并选择显示包内容。
- 转到目录>Eclipse
- 打开 Eclipse.ini
- 将值 -Xmx1024m 更改为 -Xmx2048m
- 重启 Eclipse
回答by snowfox
If you are using Mac, try running the executable inside the mat.app 'folder' with -data option, by which you can specify a writable path:
如果您使用的是 Mac,请尝试使用 -data 选项运行 mat.app 'folder' 中的可执行文件,您可以通过该选项指定可写路径:
cd mat.app/Contents/MacOS
./MemoryAnalyzer -data <writable_path>
回答by Abhishek Phoenixz
As suggested by others, its two step simple process:-
正如其他人所建议的,它的两步简单过程:-
open the MemoryAnalyzer.ini file from your MAT installation directory.
change the default -Xmx1024m to a larger size for e.g. if you have to analyze a 4GB heap dump then you can replace -Xmx1024m with -Xmx5g or -Xmx6g
从 MAT 安装目录中打开 MemoryAnalyzer.ini 文件。
将默认的 -Xmx1024m 更改为更大的大小,例如,如果您必须分析 4GB 堆转储,那么您可以将 -Xmx1024m 替换为 -Xmx5g 或 -Xmx6g
For more details refer:- https://better-coding.com/solved-eclipse-mat-java-heap-space-error/
有关更多详细信息,请参阅:- https://better-coding.com/solved-eclipse-mat-java-heap-space-error/