Memory Structure in C (1)

박영재·2024년 9월 23일
0

Virtual memory can be seen as an array of characters whose size is 2^32 (in 32-bit computer)

  1. Stack
    • Automatically managed memory; when a function returns, its stack memory is released.
    • Stores local variables, parameters, and return addresses for function calls.
  2. Heap
    • Area for dynamically allocated memory
    • The programmer manages memory allocation and deallocation (e.g., using malloc/free in C).
  3. BSS(Block Started by Symbol)
    • Contains uninitialized global and static variables.
    • Memory is initialized to zero before use but doesn't have an explicit allocation until it's assigned.
  4. Data
    • Includes initialized global and static variables.
    • These variables have assigned values when the program starts.
  5. RO Data
    • Keeps read-only constant data.
    • Includes string literals and constant arrays, which cannot be modified.
  6. Code
    • Stores instructions of a program.
    • The CPU reads instructions from this section.
    • Typically read-only and cannot be modified.
profile
People live above layers of abstraction beneath which engineers reside

0개의 댓글