Eclipse memory allocation problem

11,554

Solution 1

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.

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.

Never had this problem in unix, the heap will start with whatever the size you say even if it goes straight for swap.

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'.

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...

cheers,

f.

Solution 2

This problem you are seeing is on windows I assume?

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

-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


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)

Not the best work around, but I could never find anyting on the MAT forums indicating a bug.

Solution 3

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.

Solution 4

Have you modify the Java Runtime Environment setting in Java Control Panel? By adding Runtime parameter e.g -Xmx3072m in Runtime Parameter's column.

Maybe you can check the details here..

Increase JVM in Windows 7

Hope it's help to solve your problem..

Share:
11,554
filippo
Author by

filippo

Updated on June 12, 2022

Comments

  • filippo
    filippo almost 2 years

    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".

    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

    This is the eclipse error: alt text

    This is the MAT error: alt text

    (I reckon they are the same, this is just so you can see an example with MAT)

    My current eclipse.ini (working) is:

    -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.

  • filippo
    filippo over 13 years
    Hi buddy, I've tried that, but although the jvm started, it didn't pick up the memory settings. You sure it worked for you? check in Help -> about -> installation details -> configurations. it will show you the actual configuration. without the dash my heap was still 64mb :(
  • Sean
    Sean over 13 years
    Yeah it definitely worked. Was able to open files I couldnt before and Confirmed the memory footprint with visualVM. P.S. this was standalone MAT I am using
  • filippo
    filippo over 13 years
    Oh.. that's very odd. I did that to the standalone mat as well. The latest version has a bar in the bottom right with the memory status, with mouse over it tells the details (min, max, mark) and I also confirmed that there... this may not be a bug, but they sure could make memory confs. clearer :(
  • filippo
    filippo over 13 years
    a las in the eclipse forum gave a tip: eclipse.org/forums/…