Chapter 10 Storage management
• Elements requiring storage
• Programmer and system controlled storage
• Static Storage Management
• Heap Storage Management
Elements requiring storage
• Code segments for translated user programs
• System run-time programs - e.g. libraries• User defined data structures and
constants• Subprogram return points• Referencing environments
Elements requiring storage
• Temporaries in expression evaluation
• Temporaries in parameter transmission
• Input-Output buffers• Miscellaneous system data - tables
etc
Operations that require storage allocation
• Subprogram call and return operations - creation and deletion of activation records
• Explicit data structure creation and destruction operations
• Component insertion and deletion operations
Programmer and system controlled storage
Pros and cons:Programmer knows when to allocate / free storage.
Programmer may interfere with the system-controlled storage management
Storage-Management PhasesInitial allocationRecoveryCompaction and reuse
Static Storage Management
Static allocation : allocation during translation that remains fixed throughout execution.
Does not allow recursive subprograms
Dynamic Allocation:Heap Storage Management
Memory used for dynamic allocation of data objects in somewhat unstructured manner is called heap storage.
OS
HEAP
STACK
Heap Storage ManagementTasks:
allocation, recovery,
dangling referencesgarbage collection
compaction, reuse
Fixed size elementsVariable size elements
Heap Compaction
used used used
used
used used
used
Heap Compaction
used used used
used
used usedused