Explain merits and demerits of static and dynamic memory allocation techniques
Answers
Answered by
1
Answer:
Its not that static memory allocation is not used but its has many disadvantages or we can call them limitations :
- The scope and lifetime is limited
- Only when globally defined its scope is not bounded
- The amount of memory available through stack-based allocation is commonly far less than the amount of memory available through heap-based memory allocation.
- Once you move out of the system,the memory crashes that is a very big disadvantage.
Merits :
It has automatic cleanup and no manual assistance is required for this process.It is best used when the size is already know to you.
Dynamic Memory Allocation:
Its is performed during run time and is assigned to heap.The size may or may not be known in starting.There is no particular order of assignment.
Similar questions