Eclipse 内存分配问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3769874/
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 allocation problem
提问by filippo
I'm trying to analyse a ~800mb heap dump, which requires a bigger heap than the standard for my eclipse. however, when I go to the eclipse.ini file and set a -Xmx2g
(or -Xmx2048m
) I get an error "Failed to create the Java Virtual Machine".
我正在尝试分析一个 ~800mb 的堆转储,它需要比我的日食标准更大的堆。但是,当我转到 eclipse.ini 文件并设置一个-Xmx2g
(或-Xmx2048m
)时,出现错误“无法创建 Java 虚拟机”。
1) yes, I have enough memory. 2) I can change it up to exactly -Xmx976m. 3) I've tried the standalone MAT analyser and it works with -Xmx1024m, not a byte more. 4) No, 1gb is not enough to analyse that heap, I get a OOM
1) 是的,我有足够的内存。2)我可以把它改成-Xmx976m。3) 我试过独立的 MAT 分析器,它与 -Xmx1024m 一起工作,而不是一个字节。4) 不,1gb 不足以分析那个堆,我得到了一个 OOM
This is the eclipse error:
这是日食错误:
This is the MAT error:
这是 MAT 错误:
(I reckon they are the same, this is just so you can see an example with MAT)
(我认为它们是相同的,这只是为了您可以看到 MAT 的示例)
My current eclipse.ini (working) is:
我目前的 eclipse.ini(工作)是:
-startup
plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.0.v20100503
-product
org.eclipse.epp.package.java.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx384m
Anybody figures this out?
有人弄清楚吗?
thanks!
谢谢!
f.
F。
采纳答案by filippo
I've created a fake app to test jvm params, and what I found is that the JVM don't seems to swap in windows, at least not form the startup. I have 4gb of ram, but it only allows me to allocate the remaining free space. Odd how it works different for different appps: my fake app allowed my to go up to Xmx1380m while eclipse only went up to Xmx1024m.
我创建了一个虚假的应用程序来测试 jvm 参数,我发现 JVM 似乎没有在 Windows 中交换,至少没有形成启动。我有 4GB 的内存,但它只允许我分配剩余的可用空间。奇怪的是,对于不同的应用程序,它的工作方式有何不同:我的假应用程序允许我达到 Xmx1380m,而 eclipse 仅达到 Xmx1024m。
The error goes like:
错误是这样的:
$ java -jar -Xmx1500m "C:\fakeapp.jar"
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
Same thing but -Xmx1380g and the app went fine.
同样的事情,但 -Xmx1380g 和应用程序运行良好。
Never had this problem in unix, the heap will start with whatever the size you say even if it goes straight for swap.
在 unix 中从来没有这个问题,堆将以你所说的任何大小开始,即使它直接进行交换。
For anyone with this problem on windows: first check ctrl + shift + esc -> performance -> Physycal Memory; and set you Xmx just about the same value as shown in 'Available'.
对于在 Windows 上遇到此问题的任何人:首先检查 ctrl + shift + esc -> 性能 -> 物理内存;并将 Xmx 设置为与“可用”中显示的值大致相同。
It would be cool if someone could tell how prevent the JVM from checking if you really have enough free memory before starting. The 1.5g I'm using worked as I'm processing a heap dump of only 800mb, but if it was a little bit bigger I'd have no where to run...
如果有人能告诉 JVM 如何在开始之前检查您是否真的有足够的空闲内存,那将会很酷。我正在使用的 1.5g 可以工作,因为我正在处理只有 800mb 的堆转储,但是如果它再大一点,我将无处可逃……
cheers,
干杯,
f.
F。
回答by Sean
This problem you are seeing is on windows I assume?
您看到的这个问题是在我假设的 Windows 上?
I had the same issue. After reading your problem I went out digging again. I just found a solution to my issue. If it is the same try it out. In your Eclipse or MemoryAnalyzer ini file, remove the - fromthe Xmx option. My ini file then becomes
我遇到过同样的问题。读完你的问题后,我又出去挖掘了。我刚刚找到了解决我的问题的方法。如果是一样的试试看。在 Eclipse 或 MemoryAnalyzer ini 文件中,从 Xmx 选项中删除 -。我的ini文件然后变成
-vmargs
Xmx1536m
and now works like a charm with more memory. Thanks to the comment by Alex2308 in this thread http://troyworks.com/blog/2008/06/08/eclipse-jvm-terminated-exit-code-1/comment-page-1/#comment-80
现在就像一个具有更多内存的魅力。感谢 Alex2308 在此线程中的评论http://troyworks.com/blog/2008/06/08/eclipse-jvm-terminated-exit-code-1/comment-page-1/#comment-80
My previous solution was to get a Linux Live disc. boot to Linux and then I was able to allocated 2g in MAT without issue. (make sure you get MAT for Linux)
我以前的解决方案是获取 Linux Live 光盘。启动到 Linux,然后我就可以毫无问题地在 MAT 中分配 2g。(确保您获得了适用于 Linux 的 MAT)
Not the best work around, but I could never find anyting on the MAT forums indicating a bug.
不是最好的解决方法,但我在 MAT 论坛上找不到任何指示错误的内容。
回答by Jules
It looks like you're on a 32-bit VM. The Java VM tries to reserve its entire memory space in a single block, which means that depending on whereabouts your system DLLs are located it might not be able to get that much memory. Switching to a 64-bit VM (which obviously requires a 64-bit CPU & OS) should fix that.
看起来您使用的是 32 位虚拟机。Java VM 尝试在单个块中保留其整个内存空间,这意味着根据您的系统 DLL 所在的位置,它可能无法获得那么多内存。切换到 64 位虚拟机(显然需要 64 位 CPU 和操作系统)应该可以解决这个问题。
回答by Ivan Herlambang
Have you modify the Java Runtime Environment setting in Java Control Panel? By adding Runtime parameter e.g -Xmx3072m in Runtime Parameter's column.
您是否修改了 Java 控制面板中的 Java 运行时环境设置?通过在运行时参数的列中添加运行时参数,例如 -Xmx3072m。
Maybe you can check the details here..
也许你可以在这里查看详细信息..
Hope it's help to solve your problem..
希望对解决你的问题有所帮助..