Home » Language IDEs » Java Development Tools (JDT) » How to prevent out of memory errors?
| How to prevent out of memory errors? [message #239138] |
Thu, 21 December 2006 13:11  |
Eclipse User |
|
|
|
Originally posted by: james_adams.yahoo.com
I often need to restart Eclipse due to an out of memory error. I am
running on a Windows XP system with 3Gb of RAM, and the memory usage of
Eclipse's javaw process never exceeds 500Mb (reported by the Task
Manager). Perhaps I am using the wrong JVM options when I start Eclipse?
I currently use "-Xms256m -Xmx1024m", but I have tweaked these values
several times with no apparent effect. I have noticed over the years that
Ant builds and JUnit tests result in memory leaks when you launch them in
Eclipse -- is there something I can do which might minimize this and hence
reduce the number of out of memory errors I experience?
My configuration info:
Eclipse SDK
Version: 3.2.1
Build id: M20060921-0945
J2EE Standard Tools
Version: 1.5.2.v200610070620-kW-OA1vfaZTJtXg
Build id: 200606281211
Web Standard Tools
Version: 1.5.2.v200610070620-X3Tmm8_VLz2EcCH
Build id: 200606281211
Subclipse
Version: 1.1.9
Thanks in advance for any suggestions.
--James
|
|
| | | |
| Re: How to prevent out of memory errors? [message #239204 is a reply to message #239177] |
Sun, 24 December 2006 23:24   |
Eclipse User |
|
|
|
Originally posted by: eclipse5.rizzoweb.com
James Adams wrote:
> Unfortunately this isn't really helping, no matter how I monkey with the
> heap or permanent generation memory values. I was using the values
> below in my eclipse.ini the last time it crashed (OutOfMemoryError:
> PermGen space):
>
> -vmargs
> -Xms120m
> -Xmx1024m
> -XX:PermSize=256M
> -XX:MaxPermSize=512M
>
> I recently added another 2Gb of RAM to my system in order to avoid just
> this sort of problem. I thought I could just pop it in and not have to
> update any of my Windows XP system configuration settings. Was this
> perhaps just wishful thinking, i.e. is it possible that this is a
> problem outside of the realm of Eclipse which might require for me to
> make some system configuration changes for my extra memory? Bear in
> mind that Eclipse is the only program I run on this system which crashes
> because it runs out of memory, and it happens when there is a full 1Gb
> or more of memory to spare. Fortunately when this sort of crash happens
> Eclipse doesn't corrupt or lose much data other than its UI state, but
> this periodic crashing (once every two hours or so) is an annoyance I'd
> like to avoid if possible, especially since I just spent $250 for
> additional memory which I thought would prevent this sort of thing from
> happening.
> Any further ideas would be greatly appreciated.
The best lesson I guess you can learn from it is that physical RAM
capacity is far different than what the JVM can get or will use :-) Just
adding RAM is not enough to give Java more - you must tweak the settings
of the JVM, as you are trying to do with eclipse.ini - besides that, a
gig of RAM on windoze XP should be more than enough, even with lots of
other stuff running (for example, I run Firefox, Thunderbird, MySQL, and
Eclipse pretty much 24/7 and hardly ever see my system memory usage go
much above 1GB).
It is not clear to me what the problem is, since your VM options seem to
be valid (in fact, 512MB is about 3-4 times more memory than PermGen
space should ever need - I run Eclipse + WTP with only 128 max perm gen
space.
Only thing I would suggest is specifying a specific vm in the ini file,
to make sure Eclipse is using the JVM version you think it is. Also,
have you tried posting the .log file from a time when you see the OOM error?
Hope this helps,
Eric
|
|
| | | | |
| Re: How to prevent out of memory errors? [message #239255 is a reply to message #239250] |
Tue, 26 December 2006 17:58   |
Eclipse User |
|
|
|
Originally posted by: eclipse5.rizzoweb.com
James Adams wrote:
> Thanks Thorbjørn.
>
> Lately I've been developing an application which uses Spring, Hibernate,
> and JMS. I typically launch many JUnit/DbUnit tests which may
> incorporate an embedded ActiveMQ broker and/or an in-memory HSQLDB
> database. My DAO tests may also connect with an Oracle DataSource. I
> use Subversion/Subclipse for checking in code. Overall I don't think
> I'm doing anything out of the ordinary.
>
> java -version:
> java version "1.6.0_01"
> Java(TM) SE Runtime Environment (build 1.6.0_01-b199)
> Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)
If you are using Eclipse 3.2 under the 1.6 JVM, that could be the source
of your problems. For one thing, I'm pretty sure Eclipse does not
officially support (ie, not tested with) the 1.6 JVM. For another thing,
the PermGen memory options to java.exe may have changed with the newer
JVM. All of the discussion around PermGen space I have seen as been
about 1.4 and 1.5 JVMs.
Double-check that the way you increase PermGen space is the same for 1.6
as it was for 1.5.
> My Windows XP JAVA_HOME environment variable is set to a 1.5 JDK base
> directory since I am using Java 1.5 for my development.
JAVA_HOME system env variable has no affect on Eclipse, unless for some
reason the default JVM on your system uses it under the covers. Did you
heed the earlier advice to specify a -vm in your eclipse.ini or in the
shortcut to eclipse.exe? Doing so is the first recommendation to people
having JVM troubles with Eclipse.
> My JRE preference setting in Eclipse was set to a 1.5 JRE, and I have
> now changed it to the 1.6 JRE, which will hopefully make some difference.
The JRE preferences in Eclipse do not affect the JVM that Eclipse is
running in itself. Those settings are for running programs you launch
from Eclipse.
Hope this helps,
Eric
|
|
|
| Re: How to prevent out of memory errors? [message #239260 is a reply to message #239255] |
Tue, 26 December 2006 23:11  |
Eclipse User |
|
|
|
Originally posted by: james_adams.yahoo.com
Eric you make very good points about this perhaps being an issue with Java
1.6. I don't remember this sort of thing happening before I installed
this latest version of Java. I have set the -vm argument to a 1.5 version
Java VM, and will revert back to the 1.5 JRE setting within Eclipse for
good measure and then see what happens. If I continue to get out of
memory errors I will post again. Thanks to all for the help and insight.
--James
Eric Rizzo wrote:
> James Adams wrote:
>> Thanks Thorbjørn.
>>
>> Lately I've been developing an application which uses Spring, Hibernate,
>> and JMS. I typically launch many JUnit/DbUnit tests which may
>> incorporate an embedded ActiveMQ broker and/or an in-memory HSQLDB
>> database. My DAO tests may also connect with an Oracle DataSource. I
>> use Subversion/Subclipse for checking in code. Overall I don't think
>> I'm doing anything out of the ordinary.
>>
>> java -version:
>> java version "1.6.0_01"
>> Java(TM) SE Runtime Environment (build 1.6.0_01-b199)
>> Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)
> If you are using Eclipse 3.2 under the 1.6 JVM, that could be the source
> of your problems. For one thing, I'm pretty sure Eclipse does not
> officially support (ie, not tested with) the 1.6 JVM. For another thing,
> the PermGen memory options to java.exe may have changed with the newer
> JVM. All of the discussion around PermGen space I have seen as been
> about 1.4 and 1.5 JVMs.
> Double-check that the way you increase PermGen space is the same for 1.6
> as it was for 1.5.
>> My Windows XP JAVA_HOME environment variable is set to a 1.5 JDK base
>> directory since I am using Java 1.5 for my development.
> JAVA_HOME system env variable has no affect on Eclipse, unless for some
> reason the default JVM on your system uses it under the covers. Did you
> heed the earlier advice to specify a -vm in your eclipse.ini or in the
> shortcut to eclipse.exe? Doing so is the first recommendation to people
> having JVM troubles with Eclipse.
>> My JRE preference setting in Eclipse was set to a 1.5 JRE, and I have
>> now changed it to the 1.6 JRE, which will hopefully make some difference.
> The JRE preferences in Eclipse do not affect the JVM that Eclipse is
> running in itself. Those settings are for running programs you launch
> from Eclipse.
> Hope this helps,
> Eric
|
|
|
Goto Forum:
Current Time: Sun Nov 09 11:29:46 EST 2025
Powered by FUDForum. Page generated in 0.79643 seconds
|