File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Please teach me to investigate Out of memory error . Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Please teach me to investigate Out of memory error ." Watch "Please teach me to investigate Out of memory error ." New topic
Author

Please teach me to investigate Out of memory error .

Sutep Mahachairachun
Greenhorn

Joined: Jan 14, 2005
Posts: 2
My application has error "OutOfMemory" and I try to debug GC to log file,
But I don't know how to find out the cause from GC log.
Does any one can help to guide me analyze GC log and suggest me the way for adjust JVM options.

[JVM opts]
-server \
-Xms2g \
-Xmx2g \
-XX:NewSize=512m \
-XX:MaxNewSize=512m \
-XX:+DisableExplicitGC \
-XX:ThreadStackSize=256 \
-XX:MaxTenuringThreshold=0 \
-XX:SurvivorRatio=1024 \
-XX ermSize=64M \
-XX:MaxPermSize=64m

-verbose:gc \
-Xloggc:/GC/GC`date +%Y%m%d`.log \
-XX:+PrintGCTimeStamps -XX:+PrintGCDetails \
-XX:+PrintTenuringDistribution

[GC log]
: 1572862K->1572825K(1572864K), 6.3307708 secs] 2096702K->1993212K(2096704K), [CMS Perm : 58783K->58774K(65536K)], 6.3314086 secs]
86059.121: [GC [1 CMS-initial-mark: 1572829K(1572864K)] 2096667K(2096704K), 0.5726598 secs]
86059.696: [CMS-concurrent-mark-start]
86087.691: [Full GC 86087.692: [ParNew: 523839K->523839K(523840K), 0.0000878 secs]86087.692: [CMS86089.223: [CMS-concurrent-mark: 1.666/29.527 secs]
: 1572863K->1572823K(1572864K), 5.5275114 secs] 2096703K->1993925K(2096704K), [CMS Perm : 58781K->58774K(65536K)], 5.5280837 secs]
86093.675: [GC [1 CMS-initial-mark: 1572823K(1572864K)] 1994583K(2096704K), 0.2800800 secs]
86094.001: [CMS-concurrent-mark-start]
86107.896: [Full GC 86107.896: [ParNew: 523839K->523839K(523840K), 0.0000862 secs]86107.896: [CMS86108.959: [CMS-concurrent-mark: 1.635/14.958 secs]
: 1572847K->1572822K(1572864K), 4.9875946 secs] 2096687K->1994803K(2096704K), [CMS Perm : 58785K->58774K(65536K)], 5.0045622 secs]
86113.478: [GC [1 CMS-initial-mark: 1572822K(1572864K)] 2096662K(2096704K), 0.5670275 secs]
86114.047: [CMS-concurrent-mark-start]
86155.856: [Full GC 86155.856: [ParNew: 523839K->523839K(523840K), 0.0001770 secs]86155.856: [CMS86157.153: [CMS-concurrent-mark: 1.592/43.106 secs]
: 1572862K->1572823K(1572864K), 5.3308609 secs] 2096702K->1995505K(2096704K), [CMS Perm : 58782K->58774K(65536K)], 5.3315995 secs]
86161.739: [GC [1 CMS-initial-mark: 1572823K(1572864K)] 1995553K(2096704K), 0.2858129 secs]
86162.084: [CMS-concurrent-mark-start]
86173.754: [Full GC 86173.754: [ParNew: 523840K->523840K(523840K), 0.0000846 secs]86173.754: [CMS86174.731: [CMS-concurrent-mark: 1.607/12.647 secs]
: 1572845K->1572821K(1572864K), 5.0335458 secs] 2096685K->1996152K(2096704K), [CMS Perm : 58784K->58772K(65536K)], 5.0342192 secs]
86179.361: [GC [1 CMS-initial-mark: 1572829K(1572864K)] 2096664K(2096704K), 0.5667548 secs]
86179.929: [CMS-concurrent-mark-start]
86207.515: [Full GC 86207.515: [ParNew: 523840K->523840K(523840K), 0.0000881 secs]86207.515: [CMS86208.915: [CMS-concurrent-mark: 1.519/28.985 secs]
: 1572862K->1572822K(1572864K), 5.8271415 secs] 2096702K->1997059K(2096704K), [CMS Perm : 58780K->58772K(65536K)], 5.8277265 secs]
86213.848: [GC [1 CMS-initial-mark: 1572822K(1572864K)] 2096662K(2096704K), 0.5999998 secs]
86214.450: [CMS-concurrent-mark-start]
86227.930: [Full GC 86227.930: [ParNew: 523840K->523840K(523840K), 0.0000894 secs]86227.930: [CMS86229.357: [CMS-concurrent-mark: 1.481/14.908 secs]
: 1572835K->1572811K(1572864K), 5.7486918 secs] 2096675K->1998051K(2096704K), [CMS Perm : 58781K->58772K(65536K)], 5.7492990 secs]
86234.182: [GC [1 CMS-initial-mark: 1572812K(1572864K)] 2096652K(2096704K), 0.5279800 secs]
86234.712: [CMS-concurrent-mark-start]
86278.178: [Full GC 86278.178: [ParNew: 523840K->523840K(523840K), 0.0000918 secs]86278.178: [CMS86279.540: [CMS-concurrent-mark: 1.551/44.828 secs]
: 1572862K->1572814K(1572864K), 5.3631131 secs] 2096702K->1998905K(2096704K), [CMS Perm : 58780K->58772K(65536K)], 5.3636573 secs]
86284.209: [GC [1 CMS-initial-mark: 1572815K(1572864K)] 2096654K(2096704K), 0.5131726 secs]
86284.724: [CMS-concurrent-mark-start]
86323.085: [Full GC 86323.086: [ParNew: 523839K->523839K(523840K), 0.0000774 secs]86323.086: [CMS86324.608: [CMS-concurrent-mark: 1.672/39.884 secs]
: 1572862K->1572816K(1572864K), 5.7289521 secs] 2096702K->1999501K(2096704K), [CMS Perm : 58781K->58772K(65536K)], 5.7295485 secs]
86329.353: [GC [1 CMS-initial-mark: 1572817K(1572864K)] 2096656K(2096704K), 0.5541898 secs]

Thank you.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8836
    
    7

Out of memory exceptions are usually pretty easy to track down. What is the stack trace of your exception? What operation are you performing when the application gets the error? Reading in a file is a common cause. Filling collections with objects and never removing them is another.
If you can't identify a likely problem, get a profiler like JProbe or OptimizeIt. They let you watch memory in real time so you can track down what objects are getting allocated where.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Please teach me to investigate Out of memory error .
 
Similar Threads
"Gaps" in GC-log
Unable to create native thread in Normal Condition
How to reduce puase time in old gen ?
24 Seconds for Garbage Collection - Please help!!!
Garbage Collection interpretation