There are several main memory classifications in the program:
(1) stack storage : The main storage of local variables, function parameters, function return value and so on.
The stack memory is automatically allocated by the compiler when it is needed, and is automatically released when it is exhausted.
(2) heap storage : The space requested by new and malloc.
Need the programmer to apply for themselves, after the use of the timely release , otherwise it will cause memory leaks.
(3) Global data area (static data area): Stores global variables and static variables in the program. The initialized variable is stored separately from the uninitialized variable, but in an adjacent storage area.
The end of the program is released by the system.
(4) literal constant area : stores a constant string. the end of the program is released by the system.
(5) program code area : The binary code that holds the function body.
C + + Program Memory classification