jmap is a command-line tool that comes with the Java Development Kit (JDK). It is used to obtain memory-related information from a Java process, which is particularly useful for diagnosing memory-related issues, such as memory leaks. jmap allows you to generate heap dumps, view memory usage statistics, and retrieve information about the Java Virtual Machine (JVM).
The basic syntax for using jmap is:
jmap [options]
Where pid
is the process ID of the Java application, or executable
is the name of the Java executable.
jmap -heap
: Displays the heap memory usage.jmap -histo
: Displays a histogram of the heap.jmap -dump:format=b,file=
: Generates a heap dump to a specified file.To take a heap dump of a Java process with the PID 1234, you would run:
jmap -dump:format=b,file=heap_dump.hprof 1234
How do I avoid rehashing overhead with std::set in multithreaded code?
How do I find elements with custom comparators with std::set for embedded targets?
How do I erase elements while iterating with std::set for embedded targets?
How do I provide stable iteration order with std::unordered_map for large datasets?
How do I reserve capacity ahead of time with std::unordered_map for large datasets?
How do I erase elements while iterating with std::unordered_map in multithreaded code?
How do I provide stable iteration order with std::map for embedded targets?
How do I provide stable iteration order with std::map in multithreaded code?
How do I avoid rehashing overhead with std::map in performance-sensitive code?
How do I merge two containers efficiently with std::map for embedded targets?