5

The JVM is started using parameter -XX:+HeapDumpOnOutOfMemoryError. But its not creating heapdump on outofmemory.

Does not Java create heapdump when native allocation fails?

Following is the log:

# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 1184288 bytes for Chunk::new
# An error report file with more information is saved as:
# D:\product\bin\hs_err_pid5876.log
java.lang.OutOfMemoryError

--EDIT--

The max heap size is set to 4GB, System RAM size is 16GB and when it ran out of memory it was using >11GB (shown by windows task manager).

from the discussion with @alain.janinm.... i think i can conclude that JVm didn't even have enough memory to generate a heapdump.

So, is it possible that creating the heapdump had caused JVM to use that much system memory

Rakesh Malik
  • 607
  • 1
  • 6
  • 27
  • Which is the version of Java you're using? – alain.janinm Nov 27 '14 at 08:45
  • i am using jdk1.6 @alain.janinm – Rakesh Malik Nov 27 '14 at 08:46
  • Can you provide the exact version plz? Is this update 25? This version has this bug : http://bugs.java.com/view_bug.do?bug_id=7042582. There is a workaround at the end of the page. – alain.janinm Nov 27 '14 at 08:48
  • its JRE version: 6.0_45-b06........ I dont have the exact JDK version....... @alain.janinm – Rakesh Malik Nov 27 '14 at 08:50
  • Ok, maybe you where really out of available memory when it crashed. I don't mean heap size but actual computer memory. Do you know the size of the heap when it crashed and the available memory available on your computer? – alain.janinm Nov 27 '14 at 08:54
  • yeah.... it was actually..... heap size was set to 4GB.... syatem memory is 8GB...... task manager showed its taking 11GB system memory at that time...... might that have caused this? @alain.janinm – Rakesh Malik Nov 27 '14 at 08:56
  • How much RAM do you have? – alain.janinm Nov 27 '14 at 08:59
  • Yes this is strange, if you have 8GB of ram then how task manager can show you 11GB! Do you know if you are using a 32bit JVM? a 32bit os? – alain.janinm Nov 27 '14 at 09:05
  • i believed that its showing the rest from virtual memory...... and from the hs_err file i can see its "Java VM: Java HotSpot(TM) 64-Bit Server VM (20.45-b01 mixed mode windows-amd64 compressed oops)" @alain.janinm – Rakesh Malik Nov 27 '14 at 09:12
  • Sorry..... my mistake RAM size is 16GB @alain.janinm – Rakesh Malik Nov 27 '14 at 09:14
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/65747/discussion-between-rakeshmalik91-and-alain-janinm). – Rakesh Malik Nov 27 '14 at 09:39

1 Answers1

3

According to the error a java.lang.OutOfMemoryError has been thrown. The rest of the stacktrace indicate that it happened in the native heap. Hence the allocation failure was detected in a JNI or native method rather than in Java VM code. (from Troubleshooting memory leaks)

That is probably why no heap dump was created. According to the XX:+HeapDumpOnOutOfMemoryError documentation :

The -XX:+HeapDumpOnOutOfMemoryError command-line option tells the HotSpot VM to generate a heap dump when an allocation from the Java heap or the permanent generation cannot be satisfied.

Because the allocation failed in the native heap and not the java heap, no dump has been created.

alain.janinm
  • 19,951
  • 10
  • 65
  • 112
  • but it threw java.lang.OutOfMemoryError.... doesn't that mean both of them occurred? – Rakesh Malik Nov 27 '14 at 09:59
  • 1
    No in this case it's only thrown by the native heap, according to the log you provide. If it was java heap, you would have this `Java heap space` in the log. – alain.janinm Nov 27 '14 at 10:05