Computer Science, asked by Myin647, 1 year ago

States the marits and demarits of static and dynamic memory allocation

Answers

Answered by Aryamohanan23
0
static memory allocation demerits:-
1.If we declare more static data space than we need, we waste space.
2.If we declare less static space than we need, we are out of luck. 
3.Insertions and deletions lead to more number of movements and wastage of memory.

dynamic memory allocation demerits:-
1.    As the memory is allocated during runtime, it requires more time.
2.  Memory needs to be freed by the user when done. This is important as it is more likely to turn into bugs that are difficult to find.
Answered by Anonymous
0

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