<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://training-course-material.com/index.php?action=history&amp;feed=atom&amp;title=Java_Debugging</id>
	<title>Java Debugging - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://training-course-material.com/index.php?action=history&amp;feed=atom&amp;title=Java_Debugging"/>
	<link rel="alternate" type="text/html" href="https://training-course-material.com/index.php?title=Java_Debugging&amp;action=history"/>
	<updated>2026-05-13T19:17:21Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://training-course-material.com/index.php?title=Java_Debugging&amp;diff=23963&amp;oldid=prev</id>
		<title>Cesar Chew at 17:50, 24 November 2014</title>
		<link rel="alternate" type="text/html" href="https://training-course-material.com/index.php?title=Java_Debugging&amp;diff=23963&amp;oldid=prev"/>
		<updated>2014-11-24T17:50:34Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Cat|Java}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;slideshow style=&amp;quot;nobleprog&amp;quot; headingmark=&amp;quot;⌘&amp;quot; incmark=&amp;quot;…&amp;quot; scaled=&amp;quot;true&amp;quot; font=&amp;quot;Trebuchet MS&amp;quot; &amp;gt;&lt;br /&gt;
;title: Java Debugging&lt;br /&gt;
;author: Sam Bashton&lt;br /&gt;
&amp;lt;/slideshow&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===  Debugging Java applications ⌘===&lt;br /&gt;
&lt;br /&gt;
* Debugging tools are more limited on RHEL5&lt;br /&gt;
* Still many options&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===  Showing JVM properties ⌘===&lt;br /&gt;
&lt;br /&gt;
  jinfo &amp;lt;java process id&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===  Showing heap usage ⌘===&lt;br /&gt;
&lt;br /&gt;
* You can see the heap usage of an application with jmap&lt;br /&gt;
  jmap &amp;lt;java process id&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===  Showing object heap usage ⌘===&lt;br /&gt;
&lt;br /&gt;
  jmap -histo &amp;lt;java process id&amp;gt;&lt;br /&gt;
* It may be necessary to &amp;#039;force&amp;#039; on newer Java versions:&lt;br /&gt;
  jmap -F -histo &amp;lt;java process id&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===  Taking a thread dump ⌘===&lt;br /&gt;
&lt;br /&gt;
* Shows more details on what an application is doing&lt;br /&gt;
* Dumps thread output to stdout&lt;br /&gt;
  - If you started your Java process redirecting stdout to /dev/null,&lt;br /&gt;
    you&amp;#039;re out of luck..&lt;br /&gt;
* Take two thread dumps to show stuck threads&lt;br /&gt;
&lt;br /&gt;
   pkill -3 java; sleep 5; pkill -3 java&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===  Take a stack trace ⌘===&lt;br /&gt;
&lt;br /&gt;
* `jstack &amp;lt;java process id&amp;gt;`&lt;br /&gt;
* If the app uses JNI, take a mixed-mode trace:&lt;br /&gt;
  jstack -m &amp;lt;java process id&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===  Showing garbage collection details ⌘===&lt;br /&gt;
&lt;br /&gt;
* Start the JVM with `-verbose:gc` to get details about garbage collection printed to stdout on each collection&lt;br /&gt;
  For even more verbosity, use `-XX:+PrintGCDetails&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===  Disabling explicit garbage collection ⌘===&lt;br /&gt;
&lt;br /&gt;
* Applications can manually invoke full garbage collection by calling `System.gc()`&lt;br /&gt;
* This can be disabled by adding command line option&lt;br /&gt;
  -XX:+DisableExplicitGC` at JVM startup&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===  Exercise ⌘===&lt;br /&gt;
&lt;br /&gt;
* Try all of the mentioned techniques on your tomcat instance&lt;br /&gt;
&lt;br /&gt;
== Visualization⌘ ==&lt;br /&gt;
* jvisualvm&lt;/div&gt;</summary>
		<author><name>Cesar Chew</name></author>
	</entry>
</feed>