“insufficient memory for the Java Runtime Environment ” message in eclipse

后端 未结 10 1619
天命终不由人
天命终不由人 2020-12-08 03:51

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 all         


        
相关标签:
10条回答
  • 2020-12-08 04:47

    In my case it was that the C: drive was out of space. Ensure that you have enough space available.

    0 讨论(0)
  • 2020-12-08 04:51

    How to diagnose this error even when running the simple command:

    java -version
    #
    # There is insufficient memory for the Java Runtime Environment to continue.
    # Cannot create GC thread. Out of system resources.
    # An error report file with more information is saved as:
    # /home2/ericlesc/code/java/c2/hs_err_pid23944.log
    

    Check the amount of free memory you have:

    free -m
                 total       used       free     shared    buffers     cached
    Mem:         28119      26643       1475        189       2391      15368
    -/+ buffers/cache:       8884      19235
    Swap:         5117         34       5083
    

    Check the max number of user processes, make sure you are not over limit:

    ulimit -a
    
    ps -ef | wc -l
    

    For me, the reason this happened was because PHP had consumed too much memory allocated to me on bluehost, and the way I was able to fix it, without restarting PHP or the server ( I can't ) was to take the public_html directory and rename it. And give it a minute for PHP to see the change, then rename it back.

    A bug in the php engine itself. I found a clever way to give the PHP engine a swift kick.

    (update Feb 2016) (I'm getting a spike of up-votes on this because Bluehost instance PHP engines are reserving all the memory and leaving none for the JVM. In their defense, PHP is evolving into an unholy rube Goldberg machine. Bluehost as a service is on the decline.

    0 讨论(0)
  • 2020-12-08 04:51

    Try to modify your eclipse.ini with below

    -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.jee.product
    --launcher.defaultAction
    openFile
    --launcher.XXMaxPermSize
    512M
    -showsplash
    org.eclipse.platform
    --launcher.XXMaxPermSize
    512m
    --launcher.defaultAction
    openFile
    -vmargs
    -Dosgi.requiredJavaVersion=1.5
    -Dhelp.lucene.tokenizer=standard
    -Xms2G
    -Xmx3G
    -XX:MaxPermSize=2G
    -XX:+UseCompressedOops
    -XX:+UseParallelGC
    

    Once you open your eclipse you can try below

    Looks like your application consumes more memory than allocated (Default). I will try two things

    1. As suggested by Harmlezz increase your memory allocation to JVM to -Xms2g -Xmx2g (If needed increase it more and try it out)

    2. Download eclipse memory analyzer and check for what causing memory leak OR even you can use JConsole to see JVM memory utilization in order to figure out application memory leak issue.

    0 讨论(0)
  • 2020-12-08 04:52

    Your application (Eclipse) needs more memory and JVM is not allocating enough.You can increase the amount of memory JVM allocates by following the answers given here

    0 讨论(0)
提交回复
热议问题