Differences between heap and Stack in Java

Source: Internet
Author: User

The difference between heap and Stack in Java:    

The heap and stack that we usually say is actually the virtual machine stack and heap in the Java Virtual machine, why is the virtual machine stack, because the stack is divided into two, one is the local method stack, and the other is the virtual machine stack that we usually say. The virtual machine stack is thread-private, which means it has the same life cycle as the thread. When we use a method, a stack frame is created in the virtual machine stack to hold information such as the local variable table, the operand stack, the dynamic link, and the method interface. The heap is a thread-shared zone. For example, the location of the object we created with new () is located in the heap. The heap can also be subdivided into the old age (Eden) and the Cenozoic (from Survior and to Survior). such as GC (garbage collection) is carried out on the heap.

Differences between heap and Stack in Java

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.