Computer Science, asked by sumitkash9628, 2 months ago

What are the merits and demerits of dynamic memory allocation?

Answers

Answered by deepikamr06
0

Answer:

Disadvantages of Dynamic memory allocation

As the memory is allocated during runtime, it requires more. time.

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.

Dynamic Allocation is done at run time. Data structures can grow and shrink to fit changing data requirements. We can allocate (create) additional storage whenever we need them.DYNAMICSTATICAdvantage: Makes the most efficient use of memory as the data structure only uses as much memory as it needsDisadvantage: Can be very inefficient as the memory for the data structure has been set aside regardless of whether it is needed or not whilst the program is executing.

Dynamic memory allocation is when an executing program requests that the operating system give it a block of main memory. ... The memory comes from above the static part of the data segment. Programs may request memory and may also return previously dynamically allocated memory.Disadvantages of static and dynamic memory allocation

In static memory allocation, the system is unaware of the memory requirement of the program. So, it has to guess the memory required for the program.

Static memory allocation leads to memory wastage. As it estimates the size of memory required by the program.

Similar questions