![Page 1: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/1.jpg)
IBM Software Group
®
WebSphere® Support Technical Exchange
How to use IBM HeapAnalyzer to diagnose Java heap issues
Jinwoo Hwang ([email protected])IBM HeapAnalyzer Architect/Developer
![Page 2: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/2.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 2
IntroductionJava 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 2005Used by over 2,000 companies, government agencies, research facilities and universities worldwideNow integrated with WebSphere Application Server V6.0.2
![Page 3: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/3.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 3
Prerequisite
Java 2 SDK/JRE 1.4.1 or higher for runtime of HeapAnalyzerThe 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
![Page 4: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/4.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 4
Features
Creates a tree from Java heap dumpCalculates size of each objectsCalculates total size of each subtreeFinds size drop in a subtreeShows gap by sizeShows objects by sizeShows objects by total sizeShows objects by number of childShows types by sizeShows types by count
Shows types alphabetical orderShows gap distributionShows detailed information of an objectFinds type with regular expressionDrag and drop support in input fields and textBookmarks in tree navigationSaves/Loads processed heap dumpsLocates possible leak suspects
![Page 5: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/5.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 5
How does it work?
Reads IBM Java heap dump file and parse each object/class informationCreates graphs based on parsed informationCreates trees based on the graphsRuns Java heap leak detection engine to display suspected Java heap leak areas
![Page 6: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/6.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 6
What is IBM Java heap dump
IBM Java Virtual Machine facility generates a dump of all the live objects that are on the Java heap; that is, those that are used by the Java application. This dump is called a IBM Java Heap dump. It shows the objects that are using memory space on the Java heap.
![Page 7: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/7.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 7
Text dump structure // Version: J2RE 1.3.1 IBM Windows 32
build cn131-200209230x30000080 [10000] G
0x50001010 [6000] A0x50002020
0x50002020 [4000] B0x10007030 0x50006040 0x50004050
0x50003070 [1000] F0x50004050 0x30000080
0x50004050 [1104] C0x50005060
0x50005060 [1032] D0x50003090 0x50005060
0x50006040 [1904] I0x10007030
0x10007030 [1024] J
0x50003090 [504] E0xF00090A0 0x50003070
0xF00090A0 [0032] H
0x200000B0 [40000] K0x50002020 0x200000C0
0x200000C0 [8000] L0x200000B0
// EOF: //
// Header : build identifier of the JVM that produced the dump.Address of objectSize of objectName of objectReferences of objects…// EOF : summary of the heap dump
![Page 8: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/8.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 8
How to generate IBM Java heap dumpIBM Java Heap dump can be generated in either of two ways
Explicit generationJava Virtual Machine triggered generation
When the Java heap is exhausted, Java Virtual Machine triggered generation is enabled by default.
To enable signal-based Java Heap dumps, the IBM_HEAPDUMP=TRUE environmental variable or the appropriate JAVA_DUMP_OPTS must be set.
![Page 9: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/9.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 9
Explicit generationIBM Java Heap dump can be explicitly generated in either of the following ways
By sending a signal to the JVM from the operating systemBy 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).
![Page 10: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/10.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 10
Java Virtual Machine triggered generation
The following events automatically trigger the JVM to produce a Java Heap dump
A fatal native exception occurs in the JVM (not a Java Exception)An OutOfMemoryError or heap exhaustion condition occurs (optional)
If Java Heap dumps are enabled, they are normally produced immediately before a thread dump. They are produced also if the JVM terminates unexpectedly (a crash).
![Page 11: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/11.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 11
Location of IBM Java Heap dump
The JVM checks each of the following locations for existence and write-permission, then stores the Heap dump in the first one that is available.
The location that is specified by the IBM_HEAPDUMPDIR environment variable, if set
The current working directory of the JVM processes The location that is specified by the TMPDIR environment variable, if setThe /tmp directory (X:\tmp for Windows, where X is the current working drive)
Note that enough free disk space must be available for the Heap dump file to be written correctly.
![Page 12: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/12.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 12
Format of Heap dump filenames
Note: PID is the process ID. TIME is the number of seconds since 1/1/1970
HEAPDUMP.YYYYMMDD.HHMMSS.PID.txtz/OS
heapdumpPID.TIME.txtLinux & AIX
heapdump.YYYYMMDD.HHMMSS.PID.txtWindows
Java Heap dump file name formatPlatform
![Page 13: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/13.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 13
Creating a graph0x30000080 [10000] G
0x50001010 [6000] A0x50002020
0x50002020 [4000] B0x10007030 0x50006040 0x50004050
0x50003070 [1000] F0x50004050 0x30000080
0x50004050 [1104] C0x50005060
0x50005060 [1032] D0x50003090 0x50005060
0x50006040 [1904] I0x10007030
0x10007030 [1024] J
0x50003090 [504] E0xF00090A0 0x50003070
0xF00090A0 [0032] H
0x200000B0 [40000] K0x50002020 0x200000C0
0x200000C0 [8000] L0x200000B0
![Page 14: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/14.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 14
DefinitionsRoot 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 theparent 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 tohold that object in memory.
Total size The subtree size of an object is the sum of its size and the sizes ofall the objects that it reached from its children. Note that each object is assigned a unique parent and root during processing. If there’s substantial difference in total size between a parent and its child, it’s called a total size drop.
![Page 15: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/15.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 15
Creating a tree with DFS
Create a tree from the previous graph using Depth First Search (DFS) algorithmSorted by Total Size
![Page 16: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/16.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 16
How do I run HeapAnalyzer?
Usage <Java 2 SDK path>java –Xmx[heapsize] –jar ha<HeapAnalyzer version>.jarFor example, java –Xmx1000m –jar ha135.jar
If you see java.lang.OutOfMemoryErrorwhile you are processing heapdumps, please try increasing the maximum heap size (-Xmx) value to give the JVM more memory.
Maximum heap size should not be larger than the size of available physical memory size for this tool due to performance issue.
![Page 17: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/17.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 17
File MenuOpen 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 dumpExit
![Page 18: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/18.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 18
Open a Java heap dump
Select File -> Open and select a Java heap dump file
![Page 19: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/19.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 19
Open a processed heap dump
If you have a processed heap dump, select File -> Open and select a processed heap dump file which has .ha extension.
![Page 20: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/20.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 20
Processing heap dumpsProgress is shown during processing heapdump.
![Page 21: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/21.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 21
Processing completed
This is the screen when processing is complete. Please do not close this window until you do not need this heap dump.
![Page 22: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/22.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 22
Analysis Menu
Click on Analysis menu and select a menu item for further analysis.
![Page 23: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/23.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 23
Tree view
The check icon indicates that it has already been included as a child object of owner object in tree viewEach tree node as in the following format:TotalSize[Size] NumberOfChildObjectName Address
![Page 24: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/24.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 24
Detailed Node InformationIn tree view, you can see detailed information of a nodeYou can search for total size drop between parent and child or you can find an address by selecting a node and clicking on right mouse button.
![Page 25: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/25.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 25
Detailed Node Information
This is the screen of detailed node information in heapdump tree
![Page 26: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/26.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 26
Find an address
You can find an address in the tree view by selecting the menu “Find an address”
![Page 27: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/27.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 27
Found the address
This is the result of address search in a tree view
![Page 28: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/28.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 28
Add Bookmarks
You can bookmark nodes and continue to navigate tree
![Page 29: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/29.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 29
Go to Bookmarks
You can see list of bookmarks in “Go to Bookmark” menu in Tree view menu bar
![Page 30: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/30.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 30
Remove Bookmarks
You can remove bookmarks in “Remove Bookmark”menu in Tree view menu bar
![Page 31: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/31.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 31
Got more children?
If you have more children in a parent object, you can see how many more children are hiddenBy expanding the node, you can see more children
![Page 32: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/32.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 32
More children
10 more children are displayed
![Page 33: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/33.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 33
Another way to display more children
You can use “Show more children” menu from parent node
![Page 34: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/34.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 34
Locate a leak suspect
You can locate areas where Java heap leak is suspected
![Page 35: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/35.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 35
Found a leak suspect?
Found an area where there are relatively excessive number of children
![Page 36: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/36.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 36
Compile leak suspects
You can compile list of locate areas where Java heap leak is suspected
![Page 37: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/37.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 37
Locate a leak suspectYou can locate areas where Java heap leak is suspected by selecting a leak suspect
![Page 38: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/38.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 38
Search for total size drop
“Search for total size drop”will find a size drop between the total size of a parent and the biggest total size of child of the parent.If you cannot find any size drop from the menu “Search for total size drop”, you need to decrease Minimum total size drop for search in options.
![Page 39: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/39.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 39
Gaps by size
You can review gaps between objects and classes
![Page 40: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/40.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 40
Gaps view
This is gaps view
![Page 41: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/41.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 41
Objects List
List Objects -> Sort by TotalSize
![Page 42: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/42.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 42
Objects by TotalSize
Objects/Classes are sorted by TotalSize
![Page 43: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/43.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 43
Objects by Size
Objects/Classes are sorted by their sizes
![Page 44: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/44.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 44
Objects by number of child
Objects/Classes are sorted by number of child objects
![Page 45: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/45.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 45
Objects by address
Objects/Classes are sorted by address
![Page 46: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/46.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 46
Objects by name
Objects/Classes are sorted by name
![Page 47: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/47.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 47
Types by Name
List Types -> Sort by Name
![Page 48: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/48.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 48
Types by Name
Types are sorted by their names
![Page 49: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/49.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 49
Types by Size
Types are sorted by sum of sizes
![Page 50: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/50.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 50
Types by frequency/count
Types are sorted by frequency
![Page 51: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/51.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 51
Gap Statistics
Analysis -> Gap Statistics
![Page 52: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/52.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 52
Gap space view
Gap space distribution view
![Page 53: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/53.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 53
Options menu
You can configure setting in View -> Options menu
![Page 54: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/54.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 54
Search Objects
Search object -> Sort by TotalSize
![Page 55: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/55.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 55
Find types and objects
Address by type to find types include string “byte”
![Page 56: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/56.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 56
Search objects/types
The following is the list of types which have “byte” in their names.
![Page 57: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/57.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 57
Search Objects, Sort by Size
Objects are sorted by Size
![Page 58: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/58.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 58
Find a type
You can also enter exact name of a type: java/lang/String to get more information about a type
![Page 59: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/59.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 59
Find a type
This is the list of types of java/lang/String
![Page 60: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/60.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 60
Status bar
You can hide/show Status barStatus bar is used to display description of each menu
![Page 61: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/61.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 61
Console
You can hide/show Console
![Page 62: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/62.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 62
Common Exceptions/ErrorsException 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: 0at 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
![Page 63: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/63.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 63
Common Exceptions/ErrorsException while parsing line 9 : 0x0x50003070 [1000] java/lang/Stringjava.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 formatat 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.
![Page 64: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/64.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 64
Common Exceptions/Errors
Format error while parsing line 10 : 0x50004050 0x50004050
Unexpected format in heapdump. Possibly it’s corrupted heapdump. Further analysis is unreliable.
![Page 65: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/65.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 65
Java heap analysis: Example1
Vector v1 = new Vector();for(int i=0;i<100;i++){
int[] s1 = new int[1000];long[] s2 = new long[1000];float[] s3 = new float[1000];v1.add(s1);v1.add(s2);v1.add(s3);
}
![Page 66: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/66.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 66
Java heap analysis: Example2Vector v0 = new Vector();
Vector v2 = v0;for(int i=0;i<100;i++){Vector v1 = new Vector();int[] s1 = new int[1000];long[] s2 = new long[1000];float[] s3 = new float[1000];v1.add(s1);v1.add(s2);v1.add(s3);v2.add(v1);v2=v1;
}
![Page 67: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/67.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 67
How to analyze Java heap
Review number of objects by selecting List Types -> Sort by CountIf you see excessive number of objects, pay attention to them.
For example,DB2PreparedStatementsMQQueueManager
![Page 68: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/68.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 68
How to analyze Java heapReview Tree viewLook for areas where excessive number of child with large difference in total size between parent and child
![Page 69: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/69.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 69
How to analyze Java heap
You cannot diagnose all problems by analyzing Java heap dumps. Java Heap dumps are just snapshots of Java heap at specific times. Garbage collector trace is another source of information to figure out what’s going on with Java heap and garbage collector.
To diagnose Java heap usages, enable garbage collector trace and analyze the trace withIBM Pattern Modeling and Analysis Tool for Java Garbage Collector available at http://www.alphaworks.ibm.com/tech/pmat
![Page 70: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/70.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 70
How to copy/paste content
KeyBoardCopy: Control-CPaste: Control-VMouseSelect, drag and drop to word processors or editors that support drag and drop
![Page 71: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/71.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 71
Memory Dump Diagnostic For Java
Next generation memory leak analysis tool with best-of-breed features from HeapAnalyzer, HeapRoots and Leakbot
Technical Preview with WebSphere Version 6.0.2. Download from WebSphere DeveloperWorks: WebSphere Technology Previews
http://www-128.ibm.com/developerworks/websphere/downloads/memory_dump.html
Fully supported version to be available with IBM Support Assistant
Download and start
using today!!
![Page 72: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/72.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 72
Main Functions in Memory Dump Diagnostic for Java
Detects Memory LeaksSingle Dump Analysis
Comparative analysis of two memory dumpsVisualizes Memory Dump contentsAnalyzes Java Memory dumps
IBM heap dumps (text & binary)
HPROF dumps
SVC dumps (z-series)Detects growing data structures as opposed to low level objectsShows footprint of application heap usage
![Page 73: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/73.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 73
Additional WebSphere Product Resources
Discover the latest trends in WebSphere Technology and implementation, participate in technically-focused briefings, webcasts and podcasts at: www.ibm.com/developerworks/websphere/community/Learn about other upcoming webcasts, conferences and events: www.ibm.com/software/websphere/events_1.htmlJoin the Global WebSphere User Group Community: www.websphere.orgAccess key product show-me demos and tutorials by visiting IBM Education Assistant: ibm.com/software/info/education/assistantLearn about the Electronic Service Request (ESR) tool for submitting problems electronically: www.ibm.com/software/support/viewlet/probsub/ESR_Overview_viewlet_swf.htmlSign up to receive weekly technical support emails: www.ibm.com/software/support/einfo.html
![Page 74: How to use IBM HeapAnalyzer to diagnose Java heap issues · 2015-09-29 · IBM Software Group WebSphere® Support Technical Exchange 2 Introduction Java Heap dump contains a list](https://reader034.vdocuments.us/reader034/viewer/2022042220/5ec6d02f5c47df3b2a01b076/html5/thumbnails/74.jpg)
IBM Software Group
WebSphere® Support Technical Exchange 74
Questions and Answers