0x18 Memory Layout

Author Avatar
张Mini Nov 29, 2018
  • Read this article on other devices

Memory Layout

  • Data Section
    • Initialized Data
    • Global variables and static variables
  • Bss Section
    • Uninitialized Data
    • Global variables and static variables that are initialized to 0 or do not have explicit initialization in source code
  • Stack
    • Not maintain in Executable
    • Local Variable
  • Heap
    • Not maintain in Executable
    • Dynamic Allocate Memory
int a = 0;                      // .data

int b;                          // .bss

const double PI = 3.1415926f;   // .rodata(只读)

int main() {

    int c = 321;                // stack

    char *ad = malloc(16);      // heap

    return 0;
}