`

转储IBM JVM堆内存

    博客分类:
  • Java
 
阅读更多

来自:http://publib.boulder.ibm.com/infocenter/javasdk/v1r4m2/index.jsp?topic=%2Fcom.ibm.java.doc.diagnostics.142j9%2Fhtml%2Fenabling_a_heapdump.html

 

You can generate a Heapdump from a running JVM in either of two ways:

  • Explicit generation
  • JVM-triggered generation

When the Java™ heap is exhausted (that is, the OutOfMemory condition is encountered and the resulting exception is not caught or handled by the application), JVM-triggered generation is enabled by default, as are Heapdumps that are generated by other programming methods. To enable signal-based Heapdumps, set the IBM_HEAPDUMP or IBM_HEAP_DUMP environment variable to any value,

export IBM_HEAPDUMP=<any_value>
export IBM_HEAP_DUMP=<any_value>

or set the appropriate JAVA_DUMP_OPTS before you start the Java process. You can also use the -Xdump agent option to get more fine-grained control over Heapdumps. See Using dump agents for more information.

To display on JVM startup the conditions (if any) that will generate a Heapdump (or javadump or systemdump), you can use -Xdump:what . See Using dump agents for more information.

To disable generation of a Heapdump, on platforms other than Windows® use:

unset IBM_HEAPDUMP  
unset  IBM_HEAP_DUMP

On Windows, use:

set IBM_HEAPDUMP= 
set IBM_HEAP_DUMP=

Explicit generation of a Heapdump

You can explicitly generate a Heapdump in 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
  • By using the JVMRI to request a Heapdump from a loaded agent

You can explicitly request a Heapdump in the same way as a Javadump. Before the Heapdump starts, the heap is locked and remains locked until the whole Heapdump file is written to disk. This operation can affect the behavior of your Java application, and make it unresponsive while the dump is being produced.

For Linux and AIX®, send the JVM the signal SIGQUIT (kill -QUIT , or Ctrl+\ in the console window).

For Windows, generate a SIGINT (press the Ctrl+Break keys simultaneously).

You can explicitly request a Heapdump from a Java method. The class com.ibm.jvm.Dump contains a static HeapDump() method that causes Java code to initiate a Heapdump. To use the methods in the com.ibm.jvm.Dump class, you must have the underlying VM Reliability, Availability, and Serviceability Interface (JVMRI) enabled, by setting -Xtrace on the Java command line. For more information about JVMRI, see Using the Reliability, Availability, and Serviceability Interface .

Triggered generation of a Heapdump

The following events automatically trigger the JVM to produce a Heapdump (if enabled):

  • An OutOfMemory or heap exhaustion condition occurs and the resulting exception is not caught or handled by the application
  • If Heapdumps are enabled, they are normally produced immediately before a Javadump.

The first option is enabled by default, and you can see it with -Xdump:what . It gives a snapshot of the Java heap when no more memory is available. Usually, this snapshot is the most useful output to help you determine the cause of an OutOfMemory condition that is related to the Java heap. It works independently of the IBM_HEAPDUMP environment variable. So, by default, you get Heapdumps only when no more heap space is available; you do not get Heapdumps in crashes or through a signal to the JVM. You can disable this feature, and a similar one for Javadumps, by using IBM_HEAPDUMP_OUTOFMEMORY=FALSE and IBM_JAVADUMP_OUTOFMEMORY=FALSE respectively.

Sometimes an application will catch and handle an OutOfMemory condition, in which case no heapdumps will be taken. You can force heapdump generation for any handled OutOfMemory conditions, by setting IBM_HEAPDUMP_OUTOFMEMORY=TRUE and IBM_JAVADUMP_OUTOFMEMORY=TRUE respectively.

Enabling text formatted ("classic") Heapdumps

The generated Heapdump is by default in the binary, platform-independent, phd format, which can be examined using the available tooling (see Available tools for processing Heapdumps ). However, it is sometimes useful to have an immediately readable view of the heap. You can obtain this view by using the opts= stanza with -Xdump:heap (see Using dump agents ) or by the existence of an environment variable:

  • IBM_JAVA_HEAPDUMP_TEST , which allows you to perform the equivalent of opts=PHD+CLASSIC
  • IBM_JAVA_HEAPDUMP_TEXT , which allows the equivalent of opts=CLASSIC
分享到:
评论

相关推荐

    ibm HeapAnalyzer JVM内存分析工具 ha457.jar下载

    为了充分利用IBM HeapAnalyzer,你需要了解JVM内存管理的基本概念,包括堆内存分区、垃圾收集器的工作机制以及内存泄漏的常见模式。同时,理解如何在Java应用中生成堆转储文件也是必不可少的,这通常可以通过JVM的...

    MemoryAnalyzer JVM堆内存分析工具

    MemoryAnalyzer(MAT)是一款强大的JVM堆内存分析工具,由IBM开发并开源,它提供了详尽的内存分析报告,帮助开发者定位内存问题,提升程序效率。本文将详细介绍MemoryAnalyzer的主要功能、使用方法以及其在实际开发...

    mat(mac)---jvm内存分析工具

    总之,MAT作为一款强大的JVM内存分析工具,对于优化Java应用的内存使用,提升应用性能,尤其是对于Mac OS X平台的开发者来说,是不可或缺的利器。通过熟练掌握MAT的使用,开发者可以更有效地管理和优化应用程序的...

    IBM 堆内存分析工具

    IBM堆内存分析工具是针对Java应用程序进行性能优化和问题排查的重要辅助工具,它主要用于诊断IBM Java虚拟机(JVM)中的内存泄漏、过度分配等问题。IBM的这个工具,ha456.jar,可以帮助开发者深入理解应用程序在运行...

    IBMjvm内存分析工具

    "IBMjvm内存分析工具"是一个专门针对IBM JVM设计的工具,旨在帮助开发者和运维人员有效地诊断和解决JVM内存泄漏或死锁等问题。 首先,我们来看"gc"这个标签,它代表了垃圾收集(Garbage Collection)。在Java中,...

    ha456.jar(IBMHeapAnalyzer)JVM内存分析工具

    【ha456.jar(IBMHeapAnalyzer)JVM内存分析工具】是一款由IBM开发的专业工具,主要用于诊断Java虚拟机(JVM)的内存问题。它能够解析和分析JVM生成的内存转储文件(通常称为heap dump或hprof文件),帮助开发者识别...

    jvm内存分析工具mat安装包

    MAT,全称Memory Analyzer Tool,是IBM开发的一款强大的JVM内存分析工具,尤其适用于诊断Java应用程序的内存泄漏问题。在Java开发过程中,内存溢出(Out Of Memory)问题常常会导致程序异常终止,而MAT就是解决这类...

    JVM内存分析工具.7z

    IBM提供的ga456、ha456与jca457工具就是这样的利器,它们可以帮助开发者深入理解JVM内存的使用情况,找出内存泄漏或过度消耗内存的问题。 首先,ga456工具全称为"Garbage Collector and Memory Analyzer",它是一个...

    JVM内存问题最佳实践

    ### JVM内存问题最佳实践 #### 一、选择合适的Java虚拟机 在选择Java虚拟机(JVM)时,有几个关键因素需要考虑。首先,确保选择一个稳定的版本是非常重要的。避免使用刚刚发布或刚添加了大量新功能的版本,因为这些...

    MAT 堆内存分析工具

    使用MAT进行内存分析时,首先需要获取Java应用的堆转储文件,通常可以通过JVM的命令行参数或者JConsole、VisualVM等工具生成。然后,将堆转储文件加载到MAT中,选择合适的视图和报告进行分析。最后,根据MAT提供的...

    java IBM websphere 内存溢出 javacore deapdump CPU内存分析工具

    首先,`javacore`是一个由IBM JVM生成的转储文件,当Java应用程序出现异常或者被请求时,它会记录当前JVM的状态,包括线程、堆内存、非堆内存、类装载信息等。分析javacore文件可以帮助我们了解应用程序在出现问题时...

    IBM的内存泄漏检测工具 最新 有使用说明和教程

    它提供了一套全面的JVM监控和分析功能,包括内存分析,线程分析和性能计数器。VisualVM可以生成内存快照,并进行比较,帮助定位内存泄漏。 3. **JProfiler**: JProfiler是另一个强大的商业Java性能分析工具,支持...

    IBM heapdump分析工具

    IBM堆转储(heapdump)分析工具是一种专门用于解析和诊断IBM Java虚拟机(JVM)内存状况的工具。在Java应用程序运行过程中,如果遇到内存溢出或性能问题,IBM JVM会产生heapdump文件,其中包含了应用程序运行时内存...

    ibm查看Java内存工具.zip

    它提供了丰富的视图,包括CPU使用率、线程状态、内存分配等,可以进行堆转储分析,找出内存占用大的对象。 JConsole是Java的标准监控工具,它能够显示JVM的运行时信息,包括内存使用、线程状态、类加载和垃圾收集等...

    Jvm堆栈dump文件分析

    当JVM遇到问题,如内存溢出或长时间的垃圾回收,它可能会生成堆栈转储(dump)文件,这些文件包含了JVM在特定时刻的详细状态,包括对象、类加载器、线程、堆和栈信息。"Jvm堆栈dump文件分析"是指通过特定工具对这些...

    ibm的java内存泄漏检测工具

    1. **生成堆转储文件**:当发现应用程序性能下降或出现OutOfMemoryError时,首先需要获取heap dump。这可以通过JVM的监控和管理工具(如VisualVM或JConsole)进行,或者直接使用JVM提供的命令行选项。 2. **运行...

    基于HeapAnalyzer456.jar 分析java内存溢出

    1. **生成堆转储文件(Heap Dump)**:当Java应用程序出现内存溢出异常时,可以通过JVM参数设置(如`-XX:+HeapDumpOnOutOfMemoryError`)让JVM自动生成堆转储文件,或者通过`jmap`命令手动生成。堆转储文件是分析...

    JVM参数优化及JVM解析.docx

    5、方法区:也称为永久代,存储类的信息、常量、静态变量等,JDK 8之后被元空间(Metaspace)取代,元空间使用的是本地内存而不是JVM堆。 垃圾回收(GC)是Java程序的重要组成部分,它负责自动清理不再使用的对象,...

    IBM公司最牛的内存泄露分析工具jca

    1. 生成堆转储文件:当怀疑存在内存泄露时,可以通过JVM的命令行选项(如`-XX:+HeapDumpOnOutOfMemoryError`)或者API在出现内存溢出时生成堆转储文件。 2. 分析堆转储:使用HDA打开堆转储文件,通过其提供的各种...

    java IBM 分析工具(线程、gc、内存)

    - 获取堆快照:当怀疑有内存泄漏时,使用JVM工具`jmap`生成heap dump文件。 - 分析内存:导入heap dump文件至HeapAnalyzer。 - 查找泄漏:工具会列出占用内存最多的对象,以及它们的引用链路。 - 诊断和修复:...

Global site tag (gtag.js) - Google Analytics