C / C ++ compiler program memory area occupied is generally divided into the following five sections

C / C ++ compiler program memory area occupied is generally divided into the following five sections:

  • Stack area (stack): automatically allocated and freed by the compiler, used to store parameters of the function, local variables. Operate similarly to a stack data structure.
  • Heap (heap): generally assigned by the programmer and release (by malloc / free, new / delete), if the programmer is not released, at the end of the recovery procedure by the operating system. It heap data structure is totally different, similar distribution list.
  • Global / static area: global variables and static variables are stored in a Initializes global variables and static variables are initialized in an area, and uninitialized variables uninitialized global static variable in a region adjacent to another, after the recovery program by the operating system.
  • Literal constant region: holding the value, such as string constants and the like, can not be modified, after recovery by the operating system program.
  • Program code area: storing binary code function body.

Guess you like

Origin www.cnblogs.com/judes/p/11223462.html