CS 2150 Lecture Notes - Lecture 24: C Dynamic Memory Allocation, Directory Structure, Address Space
Document Summary
Lecture 24: memory hierarchy: static/dynamic allocation, can be placed on either the stack or the heap (usually on heap) Address space grows down" from the top (from 0xfffff . downwards: cannot outlive procedure return, handles function calls & returns. Static: space required is known before program starts (at compile time") Dynamic: space required is not known before the program starts i. ii: stack iii. iv. v, heap vi. vii. viii. ix. x. xi. xii. xiii. Fixed-size-block allocation: a free list of available blocks is kept, and the. Managed by programmer explicitly (in java, automatically done) To deallocate things within the heap, we need the address of that piece of data (use delete" with that pointer, in c use free") Compiled into the program"s code is a heap directory management routine. Subroutine is invoked f: os is consulted (requires switching context back to os, heap directory is examined (new space is determined i. somehow)