Skip to content

Instantly share code, notes, and snippets.

@githubutilities
Last active September 18, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save githubutilities/106a14997b622d16ed02 to your computer and use it in GitHub Desktop.
Save githubutilities/106a14997b622d16ed02 to your computer and use it in GitHub Desktop.
Memory Management

Memory management

Stack and Heap

Each process have its own stack and heap, while threads share common heap.

Static

According to wikipedia, when the program (executable or library) is loaded into memory, static variables are stored in the data segment of the program's address space (if initialized), or the BSS segment (if uninitialized), and are stored in corresponding sections of object files prior to loading.

Global

global variables is deallocated before main() exit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment