c ++ - Memory

 

 

  • Area for saving a program code instruction, the constant region, and global data, heap, stack, are used to store data
  • Constant region and global data area is also sometimes collectively referred to as static data area, meaning that this special memory to store data, there has been during the program run
  • When the function is called, the information pushed onto the stack will be associated with the function of parameters, local variables, return addresses, etc., after the function is executed, this information will be destroyed. Therefore, local variables, parameters are valid for the current function, the function can not be transferred to the outside, because their memory gone
  • Constant region, and global data on the stack memory allocation and deallocation automatically by the system, it can not be controlled by the programmer. The only programmers can control is the heap memory area (Heap): It is a huge memory space, often occupy most of the entire virtual space, in this space, the program can apply for a piece of memory, and use freely (put enter any data). Heap will exist until the release of the active program, not with the end of the function and failure. Data generated within the function into the stack as long as it can be used outside the function
  • In the 32-bit environment, 2GB address space of the Windows default will be assigned to high-kernel (also can be configured to 1GB), while the remaining 2GB of space assigned to the user program
  • For 64-bit program, the kernel highest occupancy 248TB, the user program takes a minimum of 8TB
  • Each thread's stack is independent, so a number of threads in the process, there are that many corresponding stack for Windows, each thread default stack size is 1MB
  • An executable program is a process, we use the C language compiler front generated after running the program is a process. The most notable feature of the process is to have a separate address spaces
  • Program is a file stored on disk, is a set of instructions and data, is a static concept; the process is loaded into activity after a series of memory to run, is a dynamic concept

Guess you like

Origin www.cnblogs.com/cxc1357/p/11809619.html