Java Virtual Machine Learning Chapter II Summary

Source: Internet
Author: User

The memory management mechanism of Java
JVM Runtime Data region: program counter, Java Virtual machine stack, local method Stack, Java heap, method area, run constant pool, (direct memory)
Classification by thread sharing: Thread exclusive
1. Program counter, occupies very small space, used to maintain the correctness of the execution process during thread switching
2.Java virtual machine Stack: Java threads do not execute a method that generates a stack frame that stores information such as local variable tables, operand stacks, dynamic links, method exits, and stack frames stored in the Java Virtual machine stack. Use-XSS to control the size of the stack. There are two situations that can cause a virtual machine stack to get an error: A. Too many stack frames, error sof! For example infinite recursion (windows64 bit I measured out is 6w+ error); b. A thread is assigned a virtual machine stack if a new thread is created, and the new virtual machine stack is not assigned to Oom;
3. Local method Stack: There is no difference between the Java Virtual machine stack, but the local native method. (Sun hotspot is merging two stacks together)
Classification by thread sharing: thread sharing
1.Java Heap: Specification Description, all object instances and arrays are allocated on the heap. An Oom exception is thrown when the extensible size is now popular, controlled with-xmx and-XMS, and can no longer be extended
2. Method Area: Stores the class information, constants, static variables, and immediately compiled code data that have been loaded by the virtual machine. Use-xx:maxpermsize for size control when the memory allocation is not sufficient to throw oom. (about-xx:permsize use, I test on the JAVA8, the hint-xx:maxpermsize invalid, need to study, view the data, found that the permanent generation in Java8 no, use what meta-space. Need to learn the changes of JAVA7-JAVA8 memory model)
3. Run a constant pool: it is part of the method area and is used to store a variety of literal variables and symbolic applications. For example, a smaller int, called The Intern () method of String.
Direct memory: Not in the JVM specification, but will be used frequently, using-XMX for size control, if there is not enough space to throw Oom

Java Virtual Machine Learning Chapter II Summary

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.