Mat analysis of two bugs that are often misunderstood in JVM dump

Source: Internet
Author: User
  1. The data in shallow is not how much, how much. Instead of starting with 16 bytes in a 64-bit JVM dump, and then increasing the number of 8 bytes, you'll find that 1 byte fields and 2 byte fields are station 16 bytes, 5 bytes in a byte field, and 24 bytes in the beginning with hidden overhead. This is done for byte alignment, a multiple of 8 bytes under 64 bits, and a multiple of 4 bytes under 32 bits. This also introduces the question of how much memory an int occupies in 32 bits and under 64 bits. I prefer that the base type occupies a certain number of bytes, but if byte alignment is required, there is room for redundancy, and this redundant space is not counted on the underlying type but on the object. Because of the byte-aligned relationship, the small object is more wasteful of memory in 64 bits than in 32 bits.
  2. The specific data in retained is important, and many people mistakenly think that the retained of an object is the object that it is associated with, or is pulling on, and that this understanding is itself a mistake. C can be a traction, C can also be B traction, then when the calculation of retained, C in the end is to calculate the retained of a or on the B retained? If an object is retained by its association, or the object being towed is interpreted at all, because the observed result is that C does not count to a retained and not to the retained of B. The correct understanding is that the retained of an object is the amount of memory space (object collection) that the object can free when it is in the GC. After selecting the AB show retained set you can see that C is only counted in retained.

Mat analysis of two bugs that are often misunderstood in JVM dump

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.