Java garbage Collection

Source: Internet
Author: User

JVM virtual machine stack, each thread runs with a line stacks, each line stacks saves the thread runtime variable value information.

When a thread accesses the value of an object, the value of the corresponding heap memory variable is first found through the object's reference stack, then the concrete value of the heap memory variable is load into the thread local memory, a copy of the variable is created, and then the thread is no longer associated with the object in the heap memory variable value, but directly modifies the value of the replica At some point after the modification (before the thread exits), the value of the thread variable copy is automatically written to the object in the heap variable. So the value of the objects in the heap changes.

The following diagram depicts this write interaction

Java keyword volatile

Variables modified with the volatile keyword, each time the thread is used, the variable is the most recent value.

Reference Link: http://www.cnblogs.com/aigongsi/archive/2012/04/01/2429166.html

Http://www.ibm.com/developerworks/cn/java/j-jtp06197.html

Java garbage Collection

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.