[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.tools.jdt] Re: How to prevent out of memory errors?
|
- From: Peter De Maeyer <peterdm@xxxxxxxxxxx>
- Date: Tue, 26 Dec 2006 20:00:19 +0100
- Newsgroups: eclipse.tools.jdt
- Organization: Eclipse
- User-agent: Thunderbird 1.5.0.8 (X11/20061221)
There are main 2 reasons why Java can truly run out of memory:
1. Memory leak: allocation of data structures without freeing them
2. Memory pressure: rapid allocation/deallocation of data structures
causing, the garbage collector cannot keep up collecting the deallocated
objects
Adding more memory of fiddling with the settings cannot fix above
problems, they can only post-pone them.
Some things I think you should be aware of to avoid the problems
described above are:
2.1. Expensive or buggy finalizers (look for classes with explicit
"finally()" implementations)
2.2. Native calls (especially those with custom implementations)
In case you still have no clue what goes wrong, the only thing left to
do is run a memory profile.
Whatever it is you're doing to cause the OutOfMemoryErrors, run a memory
profile of it. A good profiler is e.g. JProfiler.
Inspect the memory footprint, if you're lucky the thing that is eating
up all the memory should stick out clearly.
Peter
Thorbjørn Andersen wrote:
> James Adams skrev den 25-12-2006 03:09:
>
>> 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
>
> It is not because your JVM cannot get any more memory from your
> operating system, but because some internal data structure to the JVM
> runs full.
>
> I have never seen this message so I was wondering if perhaps it is your
> basic Java installation or work pattern that is different from mine.
>
> What does "java -version" and "java -fullversion" report on your system?
> Could you elaborate on what you actually DO with Eclipse?
>
> Could you try the new Java 1.6 from Sun?
>