Heap Analyzer 13 WSTE0921
Heap Analyzer 13 WSTE0921
Introduction
Java Heap dump contains a list of all the objects that are in a Java heap. Java Heap dumps could be very large (as much as giga bytes) It's not always easy to analyze large dumps. IBM HeapAnalyzer can analyze IBM Java heap dumps from Java SDK 1.3.1 and 1.4.x. IBM HeapAnalyzer is provided as-is. The top download for 11 consecutive months from the alphaWorks Java technology website (http://www.alphaworks.ibm.com/java) as of September 2005 Used by over 2,000 companies, government agencies, research facilities and universities worldwide Now integrated with WebSphere Application Server V6.0.2
Prerequisite
Java 2 SDK/JRE 1.4.1 or higher for runtime of HeapAnalyzer The following exception will be thrown if older versions of SDK/JRE are used: Exception in thread "main" java.lang.NoClassDefFoundError: java/util/regex/PatternSyntaxException IBM Java heap dump generated from IBM SDK 1.3.1 or 1.4.x For more information about getting IBM Java heap dump, refer to MustGather: Out of Memory errors on Windows
http://www-1.ibm.com/support/docview.wss?uid=swg21140641
Features
Creates a tree from Java heap dump Calculates size of each objects Calculates total size of each subtree Finds size drop in a subtree Shows gap by size Shows objects by size Shows objects by total size Shows objects by number of child Shows types by size Shows types by count Shows types alphabetical order Shows gap distribution Shows detailed information of an object Finds type with regular expression Drag and drop support in input fields and text Bookmarks in tree navigation Saves/Loads processed heap dumps Locates possible leak suspects
Explicit generation
IBM Java Heap dump can be explicitly generated in either of the following ways By sending a signal to the JVM from the operating system By using the HeapDump() method inside Java code that is being executed For Linux and AIX, send the JVM the signal SIGQUIT (kill -3, or CTRL+\ in the console window). For Windows, generate a SIGINT (press the Ctrl+Break keys simultaneously).
10
11
Windows
heapdump.YYYYMMDD.HHMMSS.PID.txt
z/OS
HEAPDUMP.YYYYMMDD.HHMMSS.PID.txt
Note: PID is the process ID. TIME is the number of seconds since 1/1/1970
WebSphere Support Technical Exchange 12
Creating a graph
0x30000080 [10000] G 0x50001010 [6000] A 0x50002020 0x50002020 [4000] B 0x10007030 0x50006040 0x50004050 0x50003070 [1000] F 0x50004050 0x30000080 0x50004050 [1104] C 0x50005060 0x50005060 [1032] D 0x50003090 0x50005060 0x50006040 [1904] I 0x10007030 0x10007030 [1024] J 0x50003090 [504] E 0xF00090A0 0x50003070 0xF00090A0 [0032] H 0x200000B0 [40000] K 0x50002020 0x200000C0 0x200000C0 [8000] L 0x200000B0
13
Definitions
Root object An object for which no (different) object holds a reference. Parent object An object (for example, A) that holds at least one reference to some (different) object (for example, B). In this case, A is said to be the parent of B. Owner object If an object has more than one parent object, a parent object is chosen as owner object. Total size is calculated only with owner objects. Child object An object (for example, B) for which at least one (different) object (for example, A) holds a reference. In this case B is said to be the child of A. Type Collection of same objects Size The size of an object is the amount of memory that is required to hold that object in memory. Total size The subtree size of an object is the sum of its size and the sizes of all the objects that it reached from its children. Note that each object is assigned a unique parent and root during processing. If theres substantial difference in total size between a parent and its child, its called a total size drop.
14
15
File Menu
Open a heap dump (Automatically detects various formats of IBM Java heap dumps, for example text, compressed text, portable heap dump and HeapAnalyzer format) Save processed heap dump Exit
17
18
19
20
Processing completed
This is the screen when processing is complete. Please do not close this window until you do not need this heap dump.
21
Analysis Menu
Click on Analysis menu and select a menu item for further analysis.
22
Tree view
The check icon indicates that it has already been included as a child object of owner object in tree view Each tree node as in the following format: TotalSize[Size] NumberOfChildObject Name Address
23
24
25
Find an address
You can find an address in the tree view by selecting the menu Find an address
26
27
Add Bookmarks
You can bookmark nodes and continue to navigate tree
28
Go to Bookmarks
You can see list of bookmarks in Go to Bookmark menu in Tree view menu bar
29
Remove Bookmarks
You can remove bookmarks in Remove Bookmark menu in Tree view menu bar
30
31
More children
10 more children are displayed
32
33
34
35
36
37
38
Gaps by size
You can review gaps between objects and classes
39
Gaps view
This is gaps view
40
Objects List
List Objects -> Sort by TotalSize
41
Objects by TotalSize
Objects/Classes are sorted by TotalSize
42
Objects by Size
Objects/Classes are sorted by their sizes
43
44
Objects by address
Objects/Classes are sorted by address
45
Objects by name
Objects/Classes are sorted by name
46
Types by Name
List Types -> Sort by Name
47
Types by Name
Types are sorted by their names
48
Types by Size
Types are sorted by sum of sizes
49
Types by frequency/count
Types are sorted by frequency
50
Gap Statistics
Analysis -> Gap Statistics
51
52
Options menu
You can configure setting in View -> Options menu
53
Search Objects
Search object -> Sort by TotalSize
54
55
Search objects/types
The following is the list of types which have byte in their names.
56
57
Find a type
You can also enter exact name of a type: java/lang/String to get more information about a type
58
Find a type
This is the list of types of java/lang/String
59
Status bar
You can hide/show Status bar Status bar is used to display description of each menu
60
Console
You can hide/show Console
61
Common Exceptions/Errors
Exception in thread "main" java.lang.NoClassDefFoundError: java/util/regex/PatternSyntaxException HeapAnalyzer requires Java 2 SDK 1.4.1 or higher. The exception is thrown if older versions SDK is used: java.lang.StringIndexOutOfBoundsException: String index out of range: 0 at java.lang.String.charAt(Unknown Source) at com.ibm.jinwoo.heap.FileTask$ActualTask.<init>(FileTask.java:386) at com.ibm.jinwoo.heap.FileTask$1.construct(FileTask.java:794) at com.ibm.jinwoo.heap.SwingWorker$2.run(SwingWorker.java:45) at java.lang.Thread.run(Unknown Source) You can see this exception while processing corrupted heapdumps or truncated ones. Truncated or corrupted heapdumps are not reliable
62
Common Exceptions/Errors
Exception while parsing line 9 : 0x0x50003070 [1000] java/lang/String java.lang.RuntimeException at com.ibm.jinwoo.heap.FileTask$ActualTask.<init>(FileTask.java:321) at com.ibm.jinwoo.heap.FileTask$1.construct(FileTask.java:794) at com.ibm.jinwoo.heap.SwingWorker$2.run(SwingWorker.java:45) at java.lang.Thread.run(Unknown Source) Some old Linux IBM SDKs generate invalid address in heapdumps. After replacing 0x0x with 0x, HeapAnalyzer can process heapdumps. java.io.IOException: Not in GZIP format at java.util.zip.GZIPInputStream.readHeader(Unknown Source) at java.util.zip.GZIPInputStream.<init>(Unknown Source) at java.util.zip.GZIPInputStream.<init>(Unknown Source) at com.ibm.jinwoo.heap.OpenTask$ActualTask.<init>(OpenTask.java:32) at com.ibm.jinwoo.heap.OpenTask$1.construct(OpenTask.java:111) at com.ibm.jinwoo.heap.SwingWorker$2.run(SwingWorker.java:45) at java.lang.Thread.run(Unknown Source) You can see this exception when you try to load invalid .ha file.
63
Common Exceptions/Errors
Format error while parsing line 10 : 0x50004050 0x50004050 Unexpected format in heapdump. Possibly its corrupted heapdump. Further analysis is unreliable.
64
65
66
67
68
69
70
71
Detects growing data structures as opposed to low level objects Shows footprint of application heap usage
72
73
74