jmap
jmap is a command-line utility that is included as part of the Java™ Development Kit (JDK). This utility prints memory-related statistics for a running JVM or core file.
If jmap is used without any command-line options, then it prints the list of shared objects
loaded. For more specific information, you can use the -heap,
-histo, or -permstat options.
- -heap
- Use the -heap option to obtain the following information:
- the name of the garbage collector
- algorithm-specific details (such as the number of threads used for parallel garbage collection)
- heap configuration information
- a heap usage summary
- -histo
- Use the -histo option to obtain a class-wise histogram of the heap. For each class, it prints the number of instances in the heap, the total amount of memory used by those objects in bytes, and the fully qualified class name. The histogram is useful when you want to understand how the heap is used.
- -permstat
- Configuring the size of the permanent generation can be important for applications that dynamically generate and load many classes (for example, Java Server Pages and web containers). If an application loads too many classes, then an OutOfMemoryError exception is thrown. Use the -permstat option to the jmap command to get statistics for the objects in the permanent generation.