“Java 运行时环境的内存不足";日食中的消息 [英] "insufficient memory for the Java Runtime Environment " message in eclipse

查看:31
本文介绍了“Java 运行时环境的内存不足";日食中的消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在 Eclipse 中运行我的 Java 代码时,我收到以下消息:

When I run my Java code in Eclipse, I get the following message:

There is insufficient memory for the Java Runtime Environment to continue.
Native memory allocation (malloc) failed to allocate 4088 bytes for AllocateHeap
An error report file with more information is saved as:
E:Eclipse_WorkspaceBTesths_err_pid1888.log

我的电脑有 4GB 内存.我也将 JRE 从 1.7 更改为 1.8.但问题似乎没有解决.我使用带有 i3 处理器的 Win 8 系统,并且我的 C 驱动器中有大约 20GB 的可用磁盘空间.

I have 4GB RAM in my computer. I have changed my JRE from 1.7 to 1.8 too. But the issue seems un-resolved. I use a Win 8 system with i3 Processor and have around 20gb of free disk space in my C Drive.

Eclipse 版本:Eclipse Juno 服务版本 2

Eclipse version: Eclipse Juno Service release 2

我在启动 Eclipse 时也收到此消息.我已附上错误消息屏幕截图.

I also get this message while starting Eclipse. I have attached the error message screen shot.

是什么导致了这个问题?

What is causing this issue?

eclipse.ini"文件中的内存参数:

-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20120913-144807
-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
-Dhelp.lucene.tokenizer=standard
-Xms40m
-Xmx512m

分辨率:重新安装eclipse解决了这个问题.

Resolution: Re-installing eclipse fixed the problem.

推荐答案

上面的消息意味着您在 PC 上运行了太多程序,以至于没有剩余内存可以再运行一个程序.这不是 Java 问题,任何 Java 选项都不会改变这一点.

The message above means that you're running so many programs on your PC that there is no memory left to run one more. This isn't a Java problem and no Java option is going to change this.

使用 Windows 的任务管理器查看您的 4GB RAM 中实际上有多少免费.我的猜测是在某个地方,您有一个程序会占用所有内存.找到并杀死它.

Use the Task Manager of Windows to see how much of your 4GB RAM is actually free. My guess is that somewhere, you have a program that eats all the memory. Find it and kill it.

编辑您需要了解有两种类型的内存不足"错误.

EDIT You need to understand that there are two types of "out of memory" errors.

第一个是 OutOfMemoryException,当 Java 代码正在运行并且 Java 不够大时,您会得到它.这意味着 Java 代码 向 Java 运行时 请求内存.您可以使用 -Xmx...

The first one is the OutOfMemoryException which you get when Java code is running and the Java heap is not large enough. This means Java code asks the Java runtime for memory. You can fix those with -Xmx...

另一个错误是 Java 运行时 内存不足.这与根本与Java堆无关.当 Java 要求操作系统提供更多内存并且操作系统说:抱歉,我没有."

The other error is when the Java runtime runs out of memory. This isn't related to the Java heap at all. This is an error when Java asks the OS for more memory and the OS says: "Sorry, I don't have any."

要解决后者,请关闭应用程序或重新启动(以清理内存碎片).

To fix the latter, close applications or reboot (to clean up memory fragmentation).

这篇关于“Java 运行时环境的内存不足";日食中的消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆