Java Memory Model and java model

Source: Internet
Author: User

Java Memory Model and java model

This article is mainly based on "deep understanding of Java Virtual Machine: JVM advanced features and Best Practices". The JDK version is 1.6, and some content has changed after version 1.8.

The Java Virtual Machine divides the memory area managed during Java program execution into five parts:Method Area, heap, virtual machine stack, local method stack, program counter.

 

 

Based on whether the thread is shared or not,The method area and heap are shared by threads., Program counters, virtual machine stacks, and local method stacks are thread-proprietary.

Program countersIt is the row number indicator of the bytecode executed by the current thread.

Virtual Machine StackDescribes the Memory Model of Java method execution: each method creates a stack frame (storing the local variable table, operand stack, dynamic link, method exit, etc.) while executing ). The method call ends until the end, and the corresponding stack frame's inbound stack to the outbound stack.

Local method StackSimilar to the Virtual Machine stack. Provides Native services for virtual machines.

HeapUsed to store object instances. Main area of garbage collection.

Method AreaStores information about classes loaded by virtual machines, constants, static variables, and compiled code.

 

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.