Shu L.
Shu L.

Reputation:

JVM throws OutOfMemory during gc though there are plenty memory left

I have my java application configured to use 5G memory. I got an OutOfMemory out of blue. I inspected the gc log and found plenty of memory left: young generation occupies 4% allocated space, tenure generation occupancy is 5% and perm generation is 43%. I am puzzled why JVM throws an OutOfMemory at the gc time. Does anyone know why this is happening? Your help is greatly appreciated.

JVM memory and gc settings:

-server -Xms5g -Xmx5g -Xss256k -XX:NewSize=2g -XX:MaxNewSize=2g -XX:+UseParallelOldGC -XX:+UseTLAB -XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=90 -XX:+DisableExplicitGC

gc.log

2009-09-19T03:34:59.741+0000: 92836.778: [GC
Desired survivor size 152567808 bytes, new threshold 1 (max 15)
 [PSYoungGen: 1941492K->144057K(1947072K)] 3138022K->1340830K(5092800K), 0.1947640 secs] [Times: user=0.61 sys=0.01, real=0.19 secs] 
2009-09-19T03:35:29.918+0000: 92866.954: [GC
Desired survivor size 152109056 bytes, new threshold 1 (max 15)
 [PSYoungGen: 1941625K->144049K(1948608K)] 3138398K->1341080K(5094336K), 0.1942000 secs] [Times: user=0.61 sys=0.01, real=0.20 secs] 
2009-09-19T03:35:56.883+0000: 92893.920: [GC
Desired survivor size 156565504 bytes, new threshold 1 (max 15)
 [PSYoungGen: 1567994K->115427K(1915072K)] 2765026K->1312820K(5060800K), 0.1586320 secs] [Times: user=0.50 sys=0.01, real=0.16 secs] 
2009-09-19T03:35:57.042+0000: 92894.079: [GC
Desired survivor size 179961856 bytes, new threshold 1 (max 15)
 [PSYoungGen: 115427K->0K(1898560K)] 1312820K->1313987K(5044288K), 0.0775650 secs] [Times: user=0.42 sys=0.19, real=0.08 secs] 
2009-09-19T03:35:57.120+0000: 92894.157: [Full GC [PSYoungGen: 0K->0K(1898560K)] [ParOldGen: 1313987K->159522K(3145728K)] 1313987K->159522K(5044288K) [PSPermGen: 20025K->19942K(40256K)], 0.56923
00 secs] [Times: user=2.18 sys=0.05, real=0.57 secs] 
2009-09-19T03:35:57.690+0000: 92894.726: [GC
Desired survivor size 197066752 bytes, new threshold 1 (max 15)
 [PSYoungGen: 0K->0K(1745728K)] 159522K->159522K(4891456K), 0.0072590 secs] [Times: user=0.01 sys=0.00, real=0.00 secs] 
2009-09-19T03:35:57.698+0000: 92894.734: [Full GC [PSYoungGen: 0K->0K(1745728K)] [ParOldGen: 159522K->158627K(3145728K)] 159522K->158627K(4891456K) [PSPermGen: 19942K->19934K(45504K)], 0.3280480
 secs] [Times: user=1.46 sys=0.00, real=0.33 secs] 
Heap
 PSYoungGen      total 1745728K, used 87233K [0x00002aab73650000, 0x00002aabf3650000, 0x00002aabf3650000)
  eden space 1745664K, 4% used [0x00002aab73650000,0x00002aab78b80778,0x00002aabddf10000)
  from space 64K, 0% used [0x00002aabddf10000,0x00002aabddf10000,0x00002aabddf20000)
  to   space 192448K, 0% used [0x00002aabe7a60000,0x00002aabe7a60000,0x00002aabf3650000)
 ParOldGen       total 3145728K, used 158627K [0x00002aaab3650000, 0x00002aab73650000, 0x00002aab73650000)
  object space 3145728K, 5% used [0x00002aaab3650000,0x00002aaabd138d28,0x00002aab73650000)
 PSPermGen       total 45504K, used 19965K [0x00002aaaae250000, 0x00002aaab0ec0000, 0x00002aaab3650000)
  object space 45504K, 43% used [0x00002aaaae250000,0x00002aaaaf5cf668,0x00002aaab0ec0000)

I am on 64-bit Linux and JRE 1.6.0_10:

$uname -a
Linux x 2.6.24-etchnhalf.1-amd64 #1 SMP Tue Oct 14 03:11:45 UTC 2008 x86_64 GNU/Linux 

$java -version
java version "1.6.0_10" 
Java(TM) SE Runtime Environment (build 1.6.0_10-b33) 
Java HotSpot(TM) 64-Bit Server VM (build 11.0-b15, mixed mode)

Upvotes: 6

Views: 4964

Answers (3)

YoK
YoK

Reputation: 14505

You might want to consider using a profiler and debugger to understand exact state in which out of memory error occurs.

I use Jprofiler for profiling and Eclipse's Debugger for debugging. Both have sufficient features for their purpose.

I would have also liked to see stack trace of error to identify kind of error and where exactly it starts coming. This is very important information missing from question.

Upvotes: 0

cjstehno
cjstehno

Reputation: 13994

Okay, probably a stupid answer but your box does have at least 5GB of RAM, right? Just checking. :-) I can't remember if the JVM actually checks whether or not you actually have enough memory until It actually tries to allocate it.

Upvotes: 3

daveb
daveb

Reputation: 76301

Also, what's the detail with the OutOfMemoryException - is it to do with the GC overhead limit? If so, that exception can be disabled (-XX:-UseGCOverheadLimit)

See this page about gc options and their explanation

Upvotes: 0

Related Questions