This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes IDEs, Version Control and other tools and the fly likes how to increase heap size with eclipse? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "how to increase heap size with eclipse?" Watch "how to increase heap size with eclipse?" New topic
Author

how to increase heap size with eclipse?

miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
i guess i used the correct term - heap - instead of memory
i have my application developed with eclipse 3, java 6, in a winXp professional with 1,99GB of memory
at the beginning i got a outOfMemory exception and thought it was something related with POI, excel and java; in this topic i was told i had to give java more memory
after some research i got it going, starting it up manually, with success:
C:\proj\bin>java -Xms256m -Xmx1000m -classpath .; gui.Mercados bd dominio excepcao gui imaAF util org com lib
(before that i had try setting those values in java console, but with no effect)
so i went back to eclipse and edited eclipse.ini:
-vmargs
-Xms256m
-Xmx1000m

if i go to eclipse configurations, i can read:
*** Date: Tue Jan 12 21:38:42 GMT 2010

*** Platform Details:

*** System properties:
awt.toolkit=sun.awt.windows.WToolkit
eclipse.buildId=M20060629-1905
eclipse.commands=-os
win32
-ws
win32
-arch
x86
-launcher
C:\eclipse\eclipse.exe
-name
Eclipse
-showsplash
600
-exitdata
4e8_c0
-vm
C:\WINDOWS\system32\javaw.exe
(...)
eclipse.vm=C:\WINDOWS\system32\javaw.exe
eclipse.vmargs=-Xms256m
-Xmx1000m

but, still, the same exception...
in the meanwhile i was told in that topic to play around with eclipse run configuratiom, which i did, but could not get a positive result

so, here i am asking how to solve this: does anyone have a concrete idea?

thanks in advance


java amateur
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I just change the -vmargs options in eclipse.ini; works for me. IIRC there are requirements for the -Xmx argument, like a multiple of 1024 or something, but I don't have an installation in front of me to check.
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
David Newton wrote:I just change the -vmargs options in eclipse.ini; works for me. IIRC there are requirements for the -Xmx argument, like a multiple of 1024 or something, but I don't have an installation in front of me to check.

i just changed it to 1024 but still that OOM... :rolleyes:

BTW what means IIRC?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

If I Remember Correctly--sorry!

What about MaxPermSize?
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
David Newton wrote:If I Remember Correctly--sorry!

What about MaxPermSize?

where would i set it?
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
in the properties window of the eclipse shortcut i set:
C:\eclipse\eclipse.exe -vmargs -Xms512m -Xmx1024m -XX:PermSize=512m -XX:MaxPermSize=512m, but
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I'd set it in the eclipse.ini, but it might work from the command line; I've just never done it like that.
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
eclipse.ini:
-vmargs
-Xms256m
-Xmx1024m
-XX:PermSize=512m
-XX:MaxPermSize=512m

but still no results
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Then there's a memory leak somewhere, or a library issue, or a capacity issue, or you just need to allocate more memory: at this point it may not be an IDE issue.
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
thank you David once again
i'm about to quit
this is a finished standalone swing application, where i wanted to read a diferent excel file
what happens is that when i read this file (with about 8 megas and only two sheets) i get that OOM error; if instead i use another exel file, everything is ok
i built this app using eclipse and ant (for jaring)
At this moment i can run and jar using command line (manually increasing heap size), but to read the jar i also need to manually increase java heap size
i tried to increase jre memory size inside java console, but it doesnt work
also, i tried (and tried over and over again) increasing heap size in eclipse, but also no results (i found the official eclipse faq, tried their solutions too, but, no, OOM pops up)
as to ant, i used ANT_OPTS to increase memory soze too, but i cant run the app with it because of the -- guess what -- OOM exception
so, if anyone has any other idea, she's welcome; else, i quit
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

Let me see if I understand this correctly. If you run your application standalone, then setting -Xmx1024m works and the app runs fine. Is that correct? If so, setting the max heap to 1024m in Eclipse will not work because Eclipse itself takes up a large amount of heap. I would try setting it to -Xmx1536m, or whatever the largest heap you can manage on your machine. That should give enough room for Eclipse and your app. Of course, if you plan to debug you might need more room...

The above assume that you are running your app in the same JVM as Ecipse, and not forking your app off into a separate JVM.

Also, you might want to set -XX:+HeapDumpOnOutOfMemoryError. Then when you get a OOME you will also get a heap dump file which you can load into VisualVM, Eclipse MAT, or some other tool and examine what is using up all the heap memory.


JBoss In Action
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
Peter Johnson wrote:Let me see if I understand this correctly. If you run your application standalone, then setting -Xmx1024m works and the app runs fine. Is that correct? If so, setting the max heap to 1024m in Eclipse will not work because Eclipse itself takes up a large amount of heap. I would try setting it to -Xmx1536m, or whatever the largest heap you can manage on your machine. That should give enough room for Eclipse and your app. Of course, if you plan to debug you might need more room...

The above assume that you are running your app in the same JVM as Ecipse, and not forking your app off into a separate JVM.

Also, you might want to set -XX:+HeapDumpOnOutOfMemoryError. Then when you get a OOME you will also get a heap dump file which you can load into VisualVM, Eclipse MAT, or some other tool and examine what is using up all the heap memory.

when playing with several memory sizes i came to the conclusion 256 was enough for running from java:
prompt> java -Xms256m -Xmx256m etc..
as i said before, setting memory size in java console is worthless, so i left it cleared, as it was at first
so, nothing set at java console (and 256 is enough for javaRE)
at eclipse init i set the max possible:
-vmargs
-Xms128m
-Xmx1024m
OOM
now i add:
-vmargs
-Xms512m
-Xmx1024m
-XX:PermSize=128m
-XX:MaxPermSize=512m
still OOM with several memory combinations
so, all this is meant to clarify your firsy point; as to the next one i guess i'm using the same vm
have to check and let you know as soon as i can
thank you!

note: i'm still convinced that what's hapening is because of the excel's file size: just two sheets and about 8 megas - because i can read from any other excel file without any problem...
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
in the meanwhile i got an important advance: eclipse runs without the OOM error!
i went to Run Settings > Separator (x) Arguments > VM Arguments
and there i wrote: -Xms256m -Xmx1024m
now i'm left with (another) serious problem: when i jar it, and then want to run the jar, i again need to manually increment memory size
does anyone have any idea how to permanently increase java memory size?
i tried setting it in java console but without any result...

thanks in advance
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to increase heap size with eclipse?
 
Similar Threads
eclipse Error. JVM terminated. Exit code = 1
Eclipse Heap Size
poi and protected excel book
JVM crash due to perm gen space 99% in use
Maven Plugin for Eclipse Helios