IOS Miscellaneous Pen-17 (heap area stack, etc.)

Source: Internet
Author: User

Stack: Automatically allocated by the system, generally storing function parameter value, local variable value and so on. Automatically created and disposed by the compiler. Its operation is similar to the stack in the data structure, that is, the principle of last-first-out, advanced-out.

For example: Declare a local variable int b in the function, and the system automatically opens up space for B in the stack.

heap: Typically applied by programmers and indicated by size, and eventually released by programmers. If the programmer does not release, the program may end up being recycled by the OS. For the management of the heap area is linked to the management of the list, the operating system has a record of the free memory address of the linked list, when the program allocates memory to receive the application, the operating system will traverse the linked list, traverse to a record memory address is greater than the requested memory of the linked list node, and the node is removed from the list, The memory address recorded by the node is then assigned to the program.

Global zone/Static zone: As the name implies, global variables and static variables are stored in this area. Only initialized global variables and static variables are stored in a block, and uninitialized global variables and static variables are stored in a block. Released by the system after the program is finished.

Literal constant area: This area mainly stores string constants. Released by the system after the program is finished.

Program code area: This area mainly stores the binary code of the function body.

IOS Miscellaneous Pen-17 (heap area stack, etc.)

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.