2

just my complete Linux box crashed with OOM (OOM Killer Process killed the wrong processes), due to a java application consumed too much memory and there was no memroy left.

My question is, if I use the JVM Paramter -XmX, does this limit Java to no more use Memory as specified by the -XmX option? Or said differently, If I do NOT specify the -XmX than java might allocate more and more memory with the result my linux box is crahsing itself with OOM?

Thank you very much! Jens

2 Answers 2

3

The default maximum for Java 6 is 1/4 of the main memory. This can mean the total virtual memory of your applications can exceed the main memory and swap space.

Given the cost of memory (8 GB costs less than £40) you should buy more memory. However, an alternative is to use less memory or increase the swap space, so you are less likely to run out.

Sign up to request clarification or add additional context in comments.

Comments

2

There's a default maximum heap size (used to be 64M, I think it's 128M now.) The -Xmx parameter changes that maximum size. Oracle's JVMs will never allocate a larger heap than specified in that parameter.

That's not to say that -Xmx gives the total amount of RAM used by the JVM; it'll actually use more than that. Some is for the executable code of the JVM implementation itself; there's also memory used for the "permgen" area, and possibly memory-mapped buffers for other purposes. But Oracle's JVMs, in any event, will not grow their RAM usage without bound; there's always an upper limit.

Now, why doesn't your Linux box have more swap space? It's cheap, and it would prevent this sort of thing from happening in the first place.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.