Download presentation
Presentation is loading. Please wait.
2
Run-time environments
Two themes The allocation of storage locations Static allocation Stack allocation Heap management Garbage collection Access to variables and data
3
Storage Organization code static Heap Free memory stack
Static---complile time Dynamic---run time Figure 7.1 Typical subdivision of runtime memory into code and data areas
4
Storage Organization Static Code
The size of the generated target code is fixed at the compile time Static Some program data objects, such as global constants ,nonlocal names one reason for statically allocating as many data objects as possible is that the address of these objects can be compiled into the target code.
5
Storage Organization Dynamic area
Size can change as the program executes To maximized the utilization of space at run time , Stack and Heap are at the opposite ends of the remainder of the address space. Stack is used to store data structures called activation records that get generated during procedure calls Heap is used to manage long lived data ,such as pointers in C and Objects in C++
6
Storage allocation strategy
Static allocation lays out storage for all data objects at compile time Stack allocation manages the run-time storage as a stack Heap allocation allocates and deallocates storage as needed at run time from a data area known as a heap
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.