[prev] 43 [next]

C execution: Memory

An executing C program partitions memory into:
  • code … fixed-size, read-only region
    • contains the machine code instructions for the program
  • global data … fixed-size
    • contain global variables (read-write) and constant strings (read-only)
  • heap … very large, read-write region
    • contains dynamic data structures created by malloc() (see later)
  • stack … dynamically-allocated data (function local vars)
    • consists of frames, one for each currently active function
    • each frame contains local variables and house-keeping info