Global memory management in C++ in stack or heap?

c++, memory-management, stack

Solution

Since I wasn't satisfied with the answers, and hope that the sameer karjatkar wants to learn more than just a simple yes/no answer, here you go.

Typically a process has 5 different areas of memory allocated

- Code - text segment

- Initialized data – data segment

- Uninitialized data – bss segment

- Heap

- Stack

If you really want to learn what is saved where then read and bookmark these:

COMPILER, ASSEMBLER, LINKER AND LOADER: A BRIEF STORY (look at Table w.5)

Anatomy of a Program in Memory

Problem

If I declare a data structure globally in a C++ application , does it consume stack memory or heap memory ? For eg ``` struct AAA { .../.../. ../../.. }arr[59652323]; ```

Original source