In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article introduces the knowledge of "the specific usage of jmap command in Java". Many people will encounter this dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
1. Introduction
Print out all the 'objects' in the memory of a java process (using pid) (e.g. those objects are generated and their number).
A tool that can output all objects in memory, and even output heap in VM into text in binary. Use the method jmap-histo pid. If you use SHELL jmap-histo pid > a.log to save it to text, after a while, using the text comparison tool, you can compare which objects have been recycled by GC. Jmap-dump:format=b,file=outfile 3024 can output the memory heap of 3024 processes to an outfile file, and then use it with MAT (memory Analysis tool (Memory Analysis Tool), see: http://blog.csdn.net/fenglibing/archive/2011/04/02/6298326.aspx) or with jhat (Java Heap Analysis Tool) to directly show whether there is a problem with the current memory in the form of an image.
For use on a 64-bit computer, you need to use the following ways:
Jmap-J-d64-heap pid
2. Command format
SYNOPSIS
Jmap [option] pid
Jmap [option] executable core
Jmap [option] [server-id@] remote-hostname-or-IP
3. Parameter description
1) options:
Executable Java executable from which the core dump was produced.
(it may be the java executable that generates core dump)
Core the core dump file of the information to be printed
Hostname or ip of the remote-hostname-or-IP remote debug service
Server-id * id, if there are multiple remote debug services on a host
2) basic parameters:
-dump: [live,] format=b,file= uses hprof binary form to output the heap content of jvm to file =. The live suboption is optional. If you specify the live option, only live objects are output to the file.
-finalizerinfo prints information about objects waiting to be reclaimed.
Heap prints the summary information of heap, the algorithm used by GC, the configuration of heap and the use of wise heap.
-histo [: live] prints the number of instances, memory usage, and class full name information for each class. The inner class name of VM begins with the prefix "*". If the live sub-parameter is added, only the number of live objects is counted.
-permstat prints information about classload and jvm heap persistent layers. Contains the name, liveliness, address, parent classloader and number of class loaded for each classloader. In addition, the number of internal String and the amount of memory will also be printed out.
-F compulsion. Use the-dump or-histo parameter when there is no corresponding pid. In this mode, the live child parameter is invalid.
-h |-help print auxiliary information
-J passes parameters to the jvm started by jmap.
Pid needs to be printed matching information of the java process id, the difference between starting a business and a part-time job-blog preview, you can use jps query.
4. Use examples
1) [fenglb@ccbu-156-5 ~] $jmap-histo 4939
[more output is not posted here]
2) [fenglb@ccbu-156-5] $jmap-dump:format=b,file=test.bin 4939
Dumping heap to / home/fenglb/test.bin...
Heap dump file created
This is the end of the content of "specific usage of the jmap command in Java". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.