Skip to main content


Showing posts from February, 2012

Memory Allocation/Segmentation in C/C++

Memory Allocation/Segmentation in C/C++ ========= | stack | | vv | | | | | | ^^ | | heap | ========= | bss | ========= | data | ========= | text | ========= address 0 Segment Description Code – text segment Often referred to as the text segment , this is the area in which the executable instructions reside.  For example, Linux/Unix arranges things so that multiple running instances of the same program share their code if possible.  Only one copy of the instructions for the same program resides in memory at any time.  The portion of the executable file containing the text segment is the text section . Initialized data – data segment Statically allocated and global data that are initialized with nonzero values live in the data segment .  Each process running the same program has its own data segment.  The portion of the executable file containing the data segment is the data section. Uninitialized data – bss