Stackis the store of variables that are allocated by the compiler when needed and automatically purged when not needed. The variables inside are usually local variables, function parameters, and so on. In a process, the user stack at the top of the user's virtual address space is compiled with it to implement the function invocation. As with heaps, the user stack can expand and contract dynamically during program execution.
Heap , which is the memory blocks allocated by new, their release compiler does not go to the tube, by our application to control, generally a new will correspond to a delete. If the programmer does not release it, the operating system will automatically recycle after the program finishes. The heap can be expanded and shrunk dynamically.
The free storage area , which is the memory blocks allocated by malloc, is very similar to the heap, but it ends up living with no.
Global /static storage , global variables and static variables are allocated in the same piece of memory, in the previous C language, the global variables are divided into initialized and uninitialized (initialized global variables and static variables in a block, uninitialized global variables and static variables in another area adjacent, While uninitialized object stores can be accessed and manipulated through void*, the system frees itself after the program ends, there is no such distinction in C + +, and they occupy the same chunk of memory.
constant Storage , which is a special piece of storage, they are stored in constant, not allowed to modify (of course, you have to pass the improper means can also be modified, and many methods).
Five basic memory allocation methods in C + +