Java Heap Stack

Source: Internet
Author: User

1. Each program runs with its own memory space, parameter calls, function calls. This space is called stack (stack)

2. All applications can request the memory they need from a shared space in the system. This space is called heap (heap)

3. The JVM automatically manages the stack and heap and cannot directly set the stack and heap.

4. Stack accesses faster than heap

5. In Java, the basic data type, Java instruction code, and constants are stored in the stack.

6. New object is allocated a certain amount of memory in the heap to hold the object instance (only the property value is saved, the method is not saved, the method belongs to the instruction, is saved in the stack)

After the object instance is allocated in the heap, a 4-byte heap memory address (similar to a pointer address) is saved in the stack.

Java Heap Stack

Related Article

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.