Skip to content

faq 73891930

Billy Charlton edited this page Sep 5, 2018 · 2 revisions

OutOfMemoryException although there is still free memory available?

by Kai Nagel on 2016-07-18 14:43:18


(kai proxying for Johannes)

 

I am facing a strange behaviour with out of memory exceptions. I have a
couple of java applications that load huge amounts of data. Sometimes they
crash with an OutOfMemoryException _although_ there is still free memory
available. After observing this for a while, i figured out that if the
application crashes, it crashes always after consuming about two third of
the allocated memory. For instance if i specify

-Xmx60G it crashes at about 42G used memory, and if specify
-Xmx50G it crashes at about 33G used memory.

Unfortunately, i cannot reproduce the problem - sometimes the processes
crash, sometimes they take up the full amount of memory without any
problem. As far as i remember, it is both, the "out of heap space"
exception as well as the "GC overhead limit" exception.

This is pretty weird but probably someone has already faced this problem.

My configurations are:
-- OpenJDK 1.7.0_55
-- two Ubuntu 12 virtual machines (one with 64G and one with 55G) that run
both via Hyper-V on a Win Server 2008 node with 128G memory

Unfortunately, i am limited in my possiblities to test this on other
hardware - espically with a non-virtualized system.

Any help appreciated. Best,
Johannes

Comments: 2


Re: OutOfMemoryException although there is still free memory available?

by Kai Nagel on 2016-07-18 14:43:54

(kai proxying for johannes)
A small update on this: The issue is that for some unknown reason the JVM
fails to allocate more memory from the OS. I don't know if it is a JVM, OS
or hardware problem. Anyway, a simple workaround is to specify the start
heap size of the JVM (with the -Xms option) to a sufficient hight value so
that the JVM will never (except for at startup) ask the OS for more
memory.

Johannes

Re: OutOfMemoryException although there is still free memory available?

by Jishnu Narayan on 2018-02-07 17:26:10

Dear Kai,

I have a query related to the topic you have mentioned. I am currently running a simulation for a scenario with close to 160000 agents and modes car, pt, taxi, walk. However, the simulation is really slow and it crashes after the second iteration with the exception:

java.lang.OutOfMemoryError: GC overhead limit exceeded

How can I increase the memory allocation as you mentioned? I am running the simulation in Eclipse.

Thank you!

Clone this wiki locally