Java Performance Optimization

Source: Internet
Author: User

1. top commands are commonly used.

Shift + m can be sorted by memory usage

Print out a java Process Using a pid) All 'object' in memory, such as the generated objects and their quantity ).

Tools that can output all objects in the memory, or even heap in the VM, can be output in binary to text. Use jmap-histo pid. If you use SHELL jmap-histo pid> a. log, you can save it to the text. After a period of time, you can use the text comparison tool to compare which objects are recycled by GC. Jmap-dump: format = B, file = outfile 3024 can output the heap Memory of the 3024 process to the outfile file, and then use the MAT Memory Analysis Tool ), use see: http://blog.csdn.net/fenglibing/archive/2011/04/02/6298326.aspx) or with jhat (Java Heap Analysis Tool) to visually display problems with the current memory in the form of images.
Use the following method on a 64-bit machine:
Jmap J-d64-heap pid

Displays information about memory usage of java processes.
Jmap pid # print the summary of memory usage
Jmap-heap pid # java heap Information
Jmap-histo: live pid # count, which indicates that
Jmap-histo pid> mem.txt # print simple information about the memory occupied by each object, usually redirected files
JMap-dump: format = B, file = mem. dat pid # output the memory usage details to the mem. dat file.



Other references

Http://docs.oracle.com/javase/7/docs/technotes/samples/hprof.html

This article is from the "seavar" blog, please be sure to keep this source http://4397407.blog.51cto.com/4387407/1287944

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.