标签:user www. last EAP enter matching api dex date
HPROF Binary Heap Dumps
Get Heap Dump on an OutOfMemoryError
One can get a HPROF binary heap dump on an OutOfMemoryError for Sun JVM (1.4.2_12 or higher and 1.5.0_07 or higher), Oracle JVMs, OpenJDK JVMs, HP-UX JVM (1.4.2_11 or higher) and SAP JVM (since 1.5.0) by setting the following JVM parameter:
-XX:+HeapDumpOnOutOfMemoryError
The heap dump is written to the work directory.
Interactively Trigger a Heap Dump
To get heap dump on demand one can add the following parameter to the JVM and press CTRL + BREAK in the preferred moment:
-XX:+HeapDumpOnCtrlBreak
HPROF agent
To use the HPROF agent to generate a dump on the end of execution, or on SIGQUIT signal use the following JVM parameter:
-agentlib:hprof=heap=dump,format=b
Alternatively, other tools can be used to acquire a heap dump:
System Dumps and Heap Dumps from IBM Virtual Machines
For a comparison of dump types, see Debugging from dumps. System dumps are simply operating system core dumps; therefore, they are a superset of portable heap dumps. System dumps are far superior than PHDs, particularly for more accurate GC roots, thread-based analysis, and unlike PHDs, system dumps contain memory contents like HPROFs.
Older versions of IBM Java (e.g. < 5.0SR12, < 6.0SR9) require running jextract on the operating system core dump which produced a zip file that contained the core dump, XML or SDFF file, and shared libraries. The IBM DTFJ feature still supports reading these jextracted zips; however, newer versions of IBM Java do not require jextract for use in MAT since DTFJ is able to directly read each supported operating system‘s core dump format. Simply ensure that the operating system core dump file ends with the .dmp suffix for visibility in the MAT Open Heap Dump selection. It is also common to zip core dumps because they are so large and compress very well. If a core dump is compressed with .zip, the IBM DTFJ feature in MAT is able to decompress the ZIP file and read the core from inside (just like a jextracted zip). The only significant downsides to system dumps over PHDs is that they are much larger, they usually take longer to produce, they may be useless if they are manually taken in the middle of an exclusive event that manipulates the underlying Java heap such as a garbage collection, and they sometimes require operating system configuration ( Linux, AIX) to ensure non-truncation.
-Xdump:system:events=systhrow,filter=java/lang/OutOfMemoryError,request=exclusive+prepwalk -Xdump:heap:none
In addition to an OutOfMemoryError, system dumps may be produced using operating system tools (e.g. gcore in gdb for Linux, gencore for AIX, Task Manager for Windows, SVCDUMP for z/OS, etc.), using the IBM Java APIs, using the various options of -Xdump, using Java Surgery, and more.
Versions of IBM Java older than IBM JDK 1.4.2 SR12, 5.0 SR8a and 6.0 SR2 are known to produce inaccurate GC root information.
Acquire Heap Dump from Memory Analyzer
If the Java process from which the heap dump is to be acquired is on the same machine as the Memory Analyzer, it is possible to acquire a heap dump directly from the Memory Analyzer. Dumps acquired this way are directly parsed and opened in the tool.
Acquiring the heap dump is VM specific. Memory Analyzer comes with several so called heap dump providers - for Oracle and Sun based VMs (needs a Oracle or Sun JDK with jmap) and for IBM VMs (needs an IBM JDK or JRE). Also extension points are provided for adopters to plug-in their own heap dump providers.
To trigger a heap dump from Memory Analyzer open the
Depending on the concrete execution environment the pre-installed heap dump providers may work with their default settings and in this case a list of running Java processes should appear: To make selection easier, the order of the Java processes can be altered by clicking on the column titles for pid or Heap Dump Provider.
One can now select from which process a heap dump should be acquired, provide a preferred location for the heap dump and press Finish to acquire the dump. Some of the heap dump providers may allow (or require) additional parameters (e.g. type of the heap dump) to be set. This can be done by using
Configuring the Heap Dump Providers
If the process list is empty try to configure the available heap dump providers. To do this press Configure... , select a matching provider from the list and click on it. You can see then what are the required settings and specify them.
If a process is selected before pressing Configure... then the corresponding dump provider will be selected on entering the Configure Heap Dump Providers... page.
Options
Multiple snapshots in one heap dump
-agentlib:hprof=heap=dump,format=bthen if a heap dump is triggered multiple times all the heap dumps will be written to one file. An IBM z/OS system dump can contain data from multiple address spaces and processes. It is therefore possible that the dump file contains heap dump snapshots from multiple Java runtimes.
Memory Analyzer 1.2 and earlier handled this situation by choosing the first heap dump snapshot found unless another was selected via an environment variable or MAT DTFJ configuration option.
Memory Analyzer 1.3 handles this situation by detecting the multiple dumps, then presenting a dialog for the user to select the required snapshot.
The index files generated have a component in the file name from the snapshot identifier, so the index files from each snapshot can be distinguished. This means that multiple snapshots from one heap dump file can be examined in Memory Analyzer simultaneously. The heap dump history for the file remembers the last snapshot selected for that file, though when the snapshot is reopened via the history the index file is also shown in the history. To open another snapshot in the dump, close the first snapshot, then reopen the heap dump file using the File menu and another snapshot can be chosen to be parsed. The first snapshot can then be reopened using the index file in the history, and both snapshots can be viewed at once.
Summary
The following table shows the availability of VM options and tools on the various platforms:
Vendor | Release | VM Parameter | Sun Tools | SAP Tool | Attach | MAT | |||
---|---|---|---|---|---|---|---|---|---|
On out of memory | On Ctrl+Break | Agent | JMap | JConsole | JVMMon | API | acquire heap dump | ||
Sun, HP | 1.4.2_12 | Yes | Yes | Yes | No | ||||
1.5.0_07 | Yes | Yes (Since 1.5.0_15) | Yes | Yes (Only Solaris and Linux) | com.sun.tools.attach | Yes (Only Solaris and Linux) | |||
1.6.0_00 | Yes | No | Yes | Yes | Yes | com.sun.tools.attach | Yes | ||
Oracle, OpenJDK, HP | 1.7.0 | Yes | No | Yes | Yes | Yes | com.sun.tools.attach | Yes | |
1.8.0 | Yes | No | Yes | Yes | Yes | com.sun.tools.attach | Yes | ||
SAP | Any 1.5.0 | Yes | Yes | Yes | Yes (Only Solaris and Linux) | Yes | |||
IBM | 1.4.2 SR12 | Yes | Yes | No | No | No | No | No | |
1.5.0 SR8a | Yes | Yes | No | No | No | No | com.ibm.tools.attach | No | |
1.6.0 SR2 | Yes | Yes | No | No | No | No | com.ibm.tools.attach | No | |
1.6.0 SR6 | Yes | Yes | No | No | No | No | com.ibm.tools.attach | Yes | |
1.7.0 | Yes | Yes | No | No | No | No | com.ibm.tools.attach | Yes | |
1.8.0 | Yes | Yes | No | No | No | No | com.ibm.tools.attach | Yes | |
1.8.0 SR5 | Yes | Yes | No | No | No | No | com.sun.tools.attach | Yes | |
OpenJ9 | 1.8.0 | Yes | Yes | No | No | Yes (PHD only) | No | com.sun.tools.attach | Yes |
标签:user www. last EAP enter matching api dex date
原文地址:https://www.cnblogs.com/tiancai/p/9559609.html