Jmap is used to solve the problem of system tomcat always holding the memory to the header and then crashing.
1. Use commands
If the environment is linux + jdk1.5 or above, this tool comes with the path under JDK_HOME/bin /.
Jmap-histo pid> a. log
2. output result summary
Size Count Class description
-------------------------------------------------------
353371288 9652324 char []
230711112 9612963 java. lang. String
139347160 114865 byte []
76128096 3172004 java. util. Hashtable $ Entry
75782280 3157595 com. test. util. IPSeeker $ IPLocation
25724272 9115 java. util. Hashtable $ Entry []
9319968 org. apache. tomcat. util. buf. MessageBytes
8533856 32889 int []
A large number of strings and custom object com. test. util. IPSeeker $ IPLocation exist. Check the program and find that memory overflow exists here. After the modified program goes online, it uses jmap to capture memory data again: www.2cto.com
146881712 207163 byte []
98976352 354285 char []
42595272 53558 int []
11515632 479818 java. util. HashMap $ Entry
9521896 59808 java. util. HashMap $ Entry []
8887392 370308 com. test. bean. UnionIPEntry
8704808 org. apache. tomcat. util. buf. MessageBytes
8066880 336120 java. lang. String
Eliminate memory overflow.
Note: When using this jmap, the jvm is in a suspended state and can only be used to solve the problem when the service is paralyzed. Otherwise, service interruption may occur.