Memory chunking in Java virtual

Source: Internet
Author: User

memory chunking in Java Virtual machine JVM (Java Vsan)

  JAVA is typically divided into 5 areas of virtual machine stacks, heaps, method areas, program counters, local method areas. We typically talk about the four zone virtual machine stacks, heaps, method areas, and program counters that are managed by the Java virtual machine .

Virtual Machine Stack

A virtual machine stack is often called a stack (stack), which is made up of multiple stack frames, a thread-private , and a stack frame is created on the stack each time a method is called to hold information such as local variables in the method.

Its life cycle is consistent with the life cycle of the method . That is, when a method call is complete, the stack frame is destroyed , and the method is called again to open a new stack frame in the stack. This is also reflected in the small scope of local variables.

Heap

Heapis the largest area of Java Virtual Machine management space and is shared by all threads .

The data for all objects is stored, and each object has a unique address in the heap, known as a reference, and a pointer in quite some languages.

when the method creates an object in the stack frame, it opens up a piece of memory in the heap space, assigns an address, and the object in the stack is the address in the heap, called ' References '.

Heap is the Java garbage collector recycles the main area , so it is also called the ' gc heap '. When the data in the heap is no longer referenced, the data becomes garbage, waiting for the Java Virtual Machine garbage collection mechanism to reclaim it.

Method area

is to load a byte-code file into Java Virtual machine, the information stored in the bytecode file, including the method information, field information, constants of some information, etc., the constant area is also known as a constant or constant pool; The data elements in the pool and the elements of the arrays are accessed through the index .

Program counter

This is a small area that holds the line number of the bytecode that the yourselves thread runs. The basic functions of branching, selection, and looping are all implemented by it.

At any one time, a processor or a kernel will run only one line in the instruction , so the program counters for each thread are independent of each other.

Local method Stack

Some of the methods implemented in other languages are stored in the stack ( Native method), and is not limited by the JVM.

Memory chunking in Java virtual

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.