0% found this document useful (0 votes)
14 views2 pages

GC FT HH 2

Uploaded by

retrogradeview
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views2 pages

GC FT HH 2

Uploaded by

retrogradeview
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Learning Resource

What is
Garbage Collection log,
Thread dump & Heap dump?
By Ram Lakshmanan
GC Log Thread dump Heap dump

What is it? GC Log contains garbage Thread dump is snapshot of Heap dump is a snapshot of
collection events related all threads running in the your application’s memory
information. It will indicate application at point in time. in a point in time. It contains
how many GC events ran, It contains all the information information such as what
what type of GC events about each thread in the are the objects in memory,
they are (i.e. Young GC or application such as: what values do they carry,
Full GC), how long did each thread state, thread Id, what is their size,
GC event pause the native Id, thread name, what other objects
application, how much stack trace, priority. do they reference.
objects did each GC event
reclaim.

How does Sample garbage collection Sample thread dump can be Sample heap dump can be
log file can be found here. found here. found here.
it look? (Note: It is going to be in
binary format. So you
actually can’t read it).

Where it is Garbage collection logs Thread dumps are primarily Heap dumps are primarily
are used to optimize the used for troubleshooting used for troubleshooting
used? GC pause times, it’s used production problems memory related,
to identify optimal memory such as CPU spikes, OutOfMemoryError problems.
size for your application, unresponsiveness in the
it’s also used to trouble application, poor response
-shoot memory related time, hung threads,
problems. high memory consumption.

How to You can generate garbage Thread dumps can be Heap dump can be captured
collection log, by passing captured using 8 different using 7 different options.
generate it? following JVM arguments: options. Most common Most common option to take
option to take thread dump heap dump is to use the
For Java versions until 8: is to use the ‘jstack’ tool. ‘jmap’ tool. jmap tool is
-XX:+PrintGCDetails jstack tool is shipped in shipped in JDK_HOME\bin
-XX:+PrintGCDateStamps JDK_HOME\bin folder. folder. Here is the command
-Xloggc:<file-path> Here is the command that that you need to issue
you need to issue to to capture:
For Java version capture thread dump:
starting from 9: jmap
-Xlog:gc*:file=<file-path> jstack -l <pid> > <file-path> -dump:format=b,
file=<file-path> <pid>
where where
file-path: is the location pid: is the Process Id of the where
where Garbage Collection application, whose thread pid: is the Java Process Id,
log file will be written dump should be captured. whose heap dump should
file-path: is the file path be captured.
where thread dump will be file-path: is the file path
written in to. where heap dump will be
written in to.

How to Here is a video tutorial, Here is a video tutorial, Heap dump files are in
which attempts to help that gives good detailed binary format and tend to
understand it? you to understand the overview on how to be large in size. Besides that,
GC log file format. understand the thread their format heavily lacks
dumps. documentation. Thus, you
have to use the heap dump
analysis tools (given in
next question) to analyze
and understand them.

What tools Gceasy fastThread Eclipse MAT


IBM GC & Memory visualizer Samurai HeapHero
can be used HP Jmeter IBM Thread & Monitor analyzer JVisualVM
Google Garbage Cat Visual VM
for analysis?

You might also like