Personal Understanding of heap and stack, personal understanding

Source: Internet
Author: User

Personal Understanding of heap and stack, personal understanding

Heap: (object)

Variables of the reference type, whose memory is allocated to the heap or constant pool (character bed constants and basic data type constants), must be created through new and other methods.

The main function of memory is to store the objects that are created (new.

(It is mainly used to store objects. The access speed is slow and the memory can be dynamically allocated during running. The lifetime does not need to be determined in advance)

STACK: (basic data type variable, object reference variable)

The main function of stack memory is to store basic data types and reference variables. stack memory management is implemented through the stack's "post-in-first-out" mode.

(Mainly used to execute programs. The access speed is fast, the size and survival time must be determined, and there is no flexibility)

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.