Rate This Document
Findability
Accuracy
Completeness
Readability

jmap

Introduction

You can run the jmap command to view object statistics in the Java heap.

Installation Mode

Use OpenJDK to install this tool. For BiSheng JDK, it is a built-in tool.

Usage

  • If a Java environment is configured, you can directly run the jmap command.
  • If no Java environment is not configured, run the ps -ef | grep java command to find the Java process. Then, switch to the JDK bin directory and run the ./jmap command.

    Syntax:

    1
    jmap -histo:live $pid
    

    Common parameters are as follows:

    Parameter

    Description

    -heap

    Displays Java heap details.

    -histo[:live]

    Displays information about live objects in the heap.

    -dump

    Generates a heap dump snapshot.

    -finalizerinfo

    Displays the information about the objects to be terminated.

    -clstats

    Displays the class loader information.