October 12, 2017

Memory structure(Stack, Heap, BSS, Data, Code)

❑ The memory is divided into five segments.
* High address → Low address : Stack → Heap → BSS → Data → Code

❑ Code(=Text) segment : This stores machine code.

❑ Data segment : This stores initialized global variable and initialized static variable.

❑ BSS : This stores uninitialized global variable and uninitialized static variable.
* BSS : Block Started by Symbol.

❑ Heap segment : This stores what the programmer dynamically allocates.
* The stored location moves from a low address to a high address.
* The heap segment is managed by the heap manager and the heap structure.
* The heap segment are used when more memory is needed than the stack segment.

❑ Stack segment : This stores temporarily assigned ones like local variable, function call information, parameter.
* The stored location moves from a high address to a low address.
* FILO(First In Last Out)

※ On windows OS, each process has 4 GB of virtual memory which is used 2 GB for user-mode and 2 GB for kernel-mode.