Advantages and disadvantages of stack and heap storage allocation
Answers
Heap
A heap is an area of pre reserved computer storages in which a program can use to store data variables. that won’t be known until the program is running .and we can say that The size of heap cannot be determined at compile time. Referenced only through pointers or references.
Advantage of heap:
heap provides for dynamic storage management.
Disadvantage:
It is an inefficient and unreliable
Stack
In programming, a stack is a data area and buffer that are used for storing requests that need to be handled. Names local to a procedure are allocated space on a stack.
Advantages:
stack allows the recursion.
stack have conserves storage.
Disadvantages:
in stack Overhead of allocation and also deallocation. Subprograms cannot be
history sensitive
stack have an Inefficient references (indirect addressing)
Heap
A
heap is an area of pre reserved computer storages in which a program can use to
store data variables. that won’t be known until the program is running .and we
can say that The size of heap cannot be determined at compile time. Referenced
only through pointers or references.
Advantage
of heap:
heap
provides for dynamic storage management.
Disadvantage:
It
is an inefficient and unreliable
Stack
In programming, a stack is a data area and buffer that are used for
storing requests that need to be handled. Names local
to a procedure are allocated space on a stack.
Advantages:
stack allows the recursion.
stack have conserves storage.
Disadvantages:
in stack Overhead of allocation and also deallocation. Subprograms cannot be
history sensitive
stack have an Inefficient references (indirect addressing)