Java Core and Heapdump

Source: Internet
Author: User

What is Java core and heap Dump

Java programs sometimes produce Java core and heap dump files when they run, typically in cases where a Java program encounters a fatal problem.

After a fatal problem occurs, the Java process can sometimes continue to run, but sometimes it hangs.

To be able to preserve the running state of a Java application before a fatal error occurs, the JVM generates two files, Javacore and heapdump files, before it dies.

The difference between javacore and heap dump

L Javacore is about the CPU.

The Javacore file primarily holds the location where the Java application's threads run at a certain point, that is, which class the JVM executes on, which method, and on which line. It is a text file that opens after you can see the execution stack of each thread, to stack trace display. Through the analysis of the Javacore file can get the application whether "card" at a certain point, that is, at a certain point of time to run too long, such as database queries, long-term failure to respond, resulting in system crashes and so on.

L The Heapdump file is about memory.

The Heapdump file is a binary file that preserves the use of objects in the JVM heap at some point, which requires tools for analysis, such as IBM Heap Analyzer. The most important function of this type of file is to analyze whether there is a memory overflow in the system.

How to generate a Java Core, Heap dump file

These two files can be generated in a manual fashion, and when we encounter a slow or unresponsive system, the Java core and heap dump files are generated in a manual fashion.

On Unix/linux, the methods for generating these two files are as follows:

# Ps-ef | grep java  
User 4616 4582 0 17:30 pts/0 00:00:00 grep java  
Root 5580 1 0 Oct27? 00:02:27/usr/bin/java-server-xx:permsize=64m-xx:maxpermsize=128m-djava.util.logging.manager= org.apache.juli.classloaderlogmanager-djava.util.logging.config.file=/usr/local/tomcat8090/conf/ Logging.properties-djava.endorsed.dirs=/usr/local/tomcat8090/endorsed-classpath:/usr/local/tomcat8090/bin/ bootstrap.jar-dcatalina.base=/usr/local/tomcat8090-dcatalina.home=/usr/local/tomcat8090-djava.io.tmpdir=/usr/ Local/tomcat8090/temp org.apache.catalina.startup.Bootstrap Start  
# kill-3 5580

First, identify the Java process ID, and then execute the ' kill-3 process number ' operation, and then do the same after the file generation, and then produce a set of files.

How to analyze Java coreibm Thread and Monitor Dump Analyzer for Java

Features: IBM thread and Monitor Dump Analyzer for Java is a tool that can be used to analyze information about each thread in the Javacore log and provide diagnostic information.

:https://www.ibm.com/developerworks/community/groups/service/html/communityview?communityUuid= 2245aa39-fa5c-4475-b891-14c205f7333c

After downloading, you can get a file with a name similar to Jca457.jar. JCA is the abbreviation for Java Coredump Analyzer, and the following number is the version number.

How to use:

The Jca***.jar is an executable jar package. You can run it by entering the following command.

-jar is the parameter that executes the jar package;-xmx is used to allocate the maximum heap memory for the process that executes jca457.

<java Runtime Environment Path>java-xmx500m-jar Jca457.jar

Heap DUMPIBM Heapanalyzer

Features: A graphical tool for finding Java heap defects.

:https://www.ibm.com/developerworks/community/groups/service/html/communityview?communityUuid= 4544bafe-c7a2-455f-9d43-eb866ea60091

After downloading, you can get a file with a name similar to Ha456.jar. HA is the abbreviation for Heap Analyzer, and the following number is the version number.

How to use:

The Jca***.jar is an executable jar package. You can run it by entering the following command.

-jar is the parameter that executes the jar package;-xmx is used to allocate the maximum heap memory for the process that executes jca457.

<java Runtime Environment Path>java–xmx4g-jar Ha456.jar

The above code allocates 4G of memory to run the process running ha456.
Note: Due to the occurrence Heapdump the resulting files tend to be large, and the process needs to consume a lot of memory when parsing files. If the allocated memory is not sufficient, it is possible that the file has not been parsed and the program will prompt for insufficient memory to interrupt the analysis. Therefore, you must ensure that the memory size of your machine is at least greater than the Heap Dump file. 

Reference

L https://www.ibm.com/developerworks/community/groups/service/html/communityview?communityUuid= 2245aa39-fa5c-4475-b891-14c205f7333c

L https://www.ibm.com/developerworks/community/groups/service/html/communityview?communityUuid= 4544bafe-c7a2-455f-9d43-eb866ea60091

L http://blog.csdn.net/newhappy2008/article/details/7592697

Http://www.cnblogs.com/jingmoxukong/p/5509196.html

Java Core and Heapdump

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.