2

I have been doing stress testing for my application. In my analysis, I did found some OutOfMemory instances in heap histogram.

726: 10 320 java.lang.OutOfMemoryError

I didn't observe OutOfMemory issue in my application logs, and neither in thread stack. What does this indicate ? Did my application encounter OOM 10 times ?

Application startup command

CommandLine flags: -XX:-BytecodeVerificationLocal -XX:-BytecodeVerificationRemote -XX:+FlightRecorder -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/home/pmc/oom.hprof -XX:InitialHeapSize=134217728 -XX:+ManagementServer -XX:MaxHeapSize=805306368 -XX:NewRatio=1 -XX:+PrintClassHistogram -XX:-PrintConcurrentLocks -XX:+PrintGC -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+UnlockCommercialFeatures -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseParallelGC

user2757415
  • 153
  • 1
  • 15

1 Answers1

0

I don't think your app ran into OutOfMemoryError for 10 times. Looks like VM is creating it on his own. I followed Javadoc but still unsure about the actual need of it.

I ran a program and took heap dump of it and seeing same thing:

Class Name                                                                                                     | Shallow Heap | Retained Heap
----------------------------------------------------------------------------------------------------------------------------------------------
java.lang.OutOfMemoryError @ 0x8001a590                                                                        |           32 |           520
java.lang.OutOfMemoryError @ 0x8001a388                                                                        |           32 |           520
java.lang.OutOfMemoryError @ 0x8001a180                                                                        |           32 |           520
java.lang.OutOfMemoryError @ 0x80019f78                                                                        |           32 |           520
java.lang.OutOfMemoryError @ 0x80001760 JNI Global                                                             |           32 |           200
|- detailMessage java.lang.String @ 0x8001a798  Java heap space: failed reallocation of scalar replaced objects|           24 |           168
|- <class> class java.lang.OutOfMemoryError @ 0x800299d0 System Class                                          |            8 |             8
'- Total: 2 entries                                                                                            |              |              
java.lang.OutOfMemoryError @ 0x80001740 JNI Global                                                             |           32 |           128
|- detailMessage java.lang.String @ 0x8001a840  GC overhead limit exceeded                                     |           24 |            96
|- <class> class java.lang.OutOfMemoryError @ 0x800299d0 System Class                                          |            8 |             8
'- Total: 2 entries                                                                                            |              |              
java.lang.OutOfMemoryError @ 0x80001720 JNI Global                                                             |           32 |           152
|- detailMessage java.lang.String @ 0x8001a8a0  Requested array size exceeds VM limit                          |           24 |           120
|- <class> class java.lang.OutOfMemoryError @ 0x800299d0 System Class                                          |            8 |             8
'- Total: 2 entries                                                                                            |              |              
java.lang.OutOfMemoryError @ 0x80001700 JNI Global                                                             |           32 |           120
|- detailMessage java.lang.String @ 0x8001a918  Compressed class space                                         |           24 |            88
|- <class> class java.lang.OutOfMemoryError @ 0x800299d0 System Class                                          |            8 |             8
'- Total: 2 entries                                                                                            |              |              
java.lang.OutOfMemoryError @ 0x800016e0 JNI Global                                                             |           32 |            96
|- detailMessage java.lang.String @ 0x8001a970  Metaspace                                                      |           24 |            64
|- <class> class java.lang.OutOfMemoryError @ 0x800299d0 System Class                                          |            8 |             8
'- Total: 2 entries                                                                                            |              |              
java.lang.OutOfMemoryError @ 0x800016c0 JNI Global                                                             |           32 |           104
|- detailMessage java.lang.String @ 0x8001a9b0  Java heap space                                                |           24 |            72
|- <class> class java.lang.OutOfMemoryError @ 0x800299d0 System Class                                          |            8 |             8
'- Total: 2 entries                                                                                            |              |              
Total: 10 entries                                                                                              |              |              
----------------------------------------------------------------------------------------------------------------------------------------------

If you are not seeing any traces of OutOfMemoryError in STDOUT/STDERR or any heap dump was not generated in -XX:HeapDumpPath=/home/pmc location, then you are good.

suv3ndu
  • 221
  • 5
  • 12
  • 2
    The JVM has to prepare itself for the scenario that when running out of memory, there’s not even enough memory left to construct a new `OutOfMemoryError`. Compare with [this answer](https://stackoverflow.com/a/46298757/2711488)… – Holger Jun 24 '21 at 15:45
  • aha! Thanks for the explanation @Holger! Somehow I missed that angle. Now I feel better. :) – suv3ndu Jun 25 '21 at 06:10