Saturday, February 2, 2008

Unix Memory Model
There are some basic regions ("segments") provided by all Unix variants:
  • Stack: (Variable size) This is where information about function call sequences is stored. There is microprocessor support for the stack.
  • Code: (Fixed size) The area of memory containing machine code instructions. Typically r+x permissions. Aka the text segment.
  • Data: (Fixed size) The area of memory containing initialized data. This includes static variables, string constants, etc.
  • BSS: (Variable size) The area of memory containing uninitialized data. This is where "heap allocated" objects live.
You can view a process' memory map with the utility pmap.