Data Segment - Global +static data which are initialised to non-zero values.
Bss - Global +static data which are initialised to zero by default.
Heap -Dynamically allocated.
Stack - Local or Auto variables
Apart from all the discussions, i read one article where there will be compiler documents which comes along with the compiler which specifies where these segments are created and how they are used.
Usually, the compiler used by intel processors contain a code segment ,data segment.
Where in the code segment is the read only area.
Data segment in turn contains stack and heap. Where heap grows from bottom to top and stack grows from top to bottom of DS.
--------------
stack |
--------------
|
--------------
|
--------------
heap |
--------------
Don't get confused with data segement and heap. They are different.
by George Belotsky
05/08/2003
http://www.linuxdevcenter.com/pub/a/linux/2003/05/08/cpp_mm-1.html?page=1
Bss - Global +static data which are initialised to zero by default.
Heap -Dynamically allocated.
Stack - Local or Auto variables
Apart from all the discussions, i read one article where there will be compiler documents which comes along with the compiler which specifies where these segments are created and how they are used.
Usually, the compiler used by intel processors contain a code segment ,data segment.
Where in the code segment is the read only area.
Data segment in turn contains stack and heap. Where heap grows from bottom to top and stack grows from top to bottom of DS.
--------------
stack |
--------------
|
--------------
|
--------------
heap |
--------------
Don't get confused with data segement and heap. They are different.
Data Segment - Global +static data which are initialised to non-zero values.
Bss - Global +static data which are initialised to zero by default.
Heap -Dynamically allocated.
Stack - Local or Auto variables
Since the heap memory is seperate from stack, you can very well access it from outside a func, even it is allocated in a func.
C++ Memory Management: From Fear to Triumph
by George Belotsky
05/08/2003
http://www.linuxdevcenter.com/pub/a/linux/2003/05/08/cpp_mm-1.html?page=1