简体   繁体   English

Eclipse内存不足

[英]Eclipse Out of Memory

I have a ATG Dust Application. 我有一个ATG粉尘应用程序。 To test my ATG application, i linked my ATG App to Dust Application by Right clicking on Dust App -> Build Path -> Link Source -> Select my ATG App. 为了测试我的ATG应用程序,我通过右键单击Dust App - > Build Path - > Link Source - >选择我的ATG应用程序将我的ATG应用程序链接到Dust Application。 ATG app is a big application. ATG app是一个很大的应用程序。 When i try to clean build the DUSt App, i get the exception like "An out of memory exception has occurred. Consult the " Running Eclipse"section....." 当我尝试清理构建DUSt应用程序时,我得到异常,例如“发生内存不足异常。请参阅”运行Eclipse“部分.....”

In the eclipse .log file has the following exception logged, 在eclipse .log文件中记录了以下异常,

// From the Log File   
    !ENTRY org.eclipse.core.jobs 4 2 2014-03-27 06:56:26.549
    !MESSAGE An internal error occurred during: "Launching SampleTest".
    !STACK 0

// Exception
 java.lang.OutOfMemoryError: Java heap space
        at java.util.Arrays.copyOfRange(Unknown Source)
        at java.lang.String.<init>(Unknown Source)

just right-click on your file in eclipse and select as Run as -> Run configuration . 只需在eclipse中右键单击您的文件,然后选择Run as - > Run configuration。 It will open Run Configurations Dialog Box .Click on Arguments Tab 它将打开“运行配置”对话框。单击“参数”选项卡

Enter this value 输入此值

                    -Xms1024m -Xmx3072m -XX:MaxPermSize=1024M

In Vm Arguments and press run 在Vm Arguments中并按下运行

The Out of Memory issue is something that occurs due to the improper handling of Heap. Out of Memory问题是由于Heap处理不当而发生的。 You must optimise the code to avoid that. 您必须优化代码以避免这种情况。 As a temporary fix you can increase the heap space. 作为临时修复,您可以增加堆空间。

-XX:MaxPermSize=512m
-Xms512m
-Xmx1024m

Like Dileep said, the problem is possibly an improper handling of heap space. 就像Dileep所说,问题可能是对堆空间的不当处理。

Increased heapsize might not solve the problem, but work around it for a while. 增加堆大小可能无法解决问题,但可以解决一段时间。 You can set the parameter -XX:+HeapDumpOnOutOfMemoryError in your eclipse.ini . 您可以在eclipse.ini设置参数-XX:+HeapDumpOnOutOfMemoryError This will write a heapdump out, which can be analzed by tools like Eclipse Memory Analyzer . 这将编写一个heapdump,可以通过Eclipse Memory Analyzer等工具进行分析 Try to make sure that you don't have a memory leak before using up more space. 在占用更多空间之前,请确保没有内存泄漏。

in your case java.util.Arrays.copyOfRange is copying parts of Arrays around. 在你的情况下, java.util.Arrays.copyOfRange正在复制Arrays的部分内容。 you could start with checking what size they are. 你可以从检查它们的大小开始。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM