CHAMELI DEVI GROUP OF INSTITUTIONS,INDORE
Compiler Design CS-603(C)
Presentation on
STORAGE ALLOCATION
STRATEGIES
Submitted By:
Submitted To: Anurag Tiwari(0832CS211029)
Prof. Sumeet Kothari Anushka Laad(0832CS211030)
CSE Department Anushka Sharma(0832CS211031)
Arpit Patidar(0832CS211032)
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING
Storage Allocation
• Storage Allocation refers to assigning memory to a program that has to be
executed.
• Storage allocation strategy refers to the process of assigning memory locations
to variables and data structures during the execution of a program.
Subdivision of Runtime Memory
• The program that you want to be executed that will be stored in SYMBOL
TABLE .
• Symbol Table holds the information regarding the program.
STATIC ALLOCATION
• The memory is allocated at compile time.
• Memory is allocated only one time.
• Fixed side of memory is allocated.
• The memory is allocated at compile time and deacllocated after completion.
• Example: Array
Disadvantage of Static Allocation
• Size of memory is fixed.
• If more memory is allocated then required then the memory is wasted.
• If less memory is allocated then required that also creates a problem.
• Insertion and Deletion operations are expensive.
STACK ALLOCATION
• In Stack Allocation activation records are created when a procedure or function
is called.
• Activation records are pushed or poped .
• It works on the LIFO(Last In First Out).
• This allocation supports recursion.
• When a procedure call occurs Activation Record is pushed into the Stack.
• When a procedure call ends Activation Record is poped from the Stack.
• Slower than Static Allocation.
Activation Record Model
Heap Allocation
• Most flexible allocation scheme.
• Memory is allocated at run time.
• Dynamically allocates the memory.
• The memory is allocated to the user at any time depending upon the
requirement.
• Supports recursion.
Thank You