Memory layout------C + + programming fundamentals, programming abstractions and algorithmic strategies

Source: Internet
Author: User

The diagram shows a framework for how to organize memory in a typical C + + program. The instructions in the program (which are stored at the bottom level) and global variables are often stored statically (static area), which is located at the beginning of the near machine address space where the address number is smaller. The amount of memory allocated in the zone does not change during program operation.

The highest address area in memory represents the stack area. When your program calls a function or method, the computer creates a new stack frame in the memory area. When the function returns, the created stack frame is revoked, freeing the memory for the stack frame required for subsequent function calls.

The area of memory between the stack area and the static zone is called the heap area. This area is useful when the program is running with more memory requested.

The temporary variable for the inline function exists on the stack of main, which is equivalent to the temporary variable of main.

C + + Program design basics, programming abstraction and algorithm strategy

Memory layout------C + + programming fundamentals, programming abstractions and algorithmic strategies

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.