“I bought this guide a few days ago to prepare for my interview with Oracle. Many of the questions they asked me were from this guide. I found this book absolutely great!”
Read more comments...
How do you do dynamic memory allocation in C applications. Advantages and disadvantages of dynamic memory allocation vs. static memory allocation.
5,360 Views | (20 votes, avg: 3.05)
using malloc, calloc and realloc.
disadvantage is run-time overhead and complexity in implementing it…
Dynanic memory needs to be carefully deleted after use.
They are created in distributed area of memory segment.
Disadvantages1. Dynamic memory allocation is slower than static memory allocation, because dynamic memory allocation happens in heap area.
2. Dynamic memory allocation causes contention between threads, so it degrades performance when it happens in a thread.
Static memory allocation provides speed at the cost of flexibility compared to dynamic memory allocation.
In static memory allocation memory is assigned during compilation time. In dynamic memory allocation memory is assigned during run time.
static memory allocation use less memory incontrast to DMA DMA used for best utilization of memory
both have their own ad & disad
Name (required)
Mail (will not be published) (required)
Your Answer
To prove you're a person (not a spam script), type the security text shown in the picture. Click here to regenerate some new text.
using malloc, calloc and realloc.
disadvantage is run-time overhead and complexity in implementing it…
Dynanic memory needs to be carefully deleted after use.
They are created in distributed area of memory segment.
Disadvantages
1. Dynamic memory allocation is slower than static memory allocation, because dynamic memory allocation happens in heap area.
2. Dynamic memory allocation causes contention between threads, so it degrades performance when it happens in a thread.
Static memory allocation provides speed at the cost of flexibility compared to dynamic memory allocation.
In static memory allocation memory is assigned during compilation time.
In dynamic memory allocation memory is assigned during run time.
static memory allocation use less memory incontrast to DMA
DMA used for best utilization of memory
both have their own ad & disad
Leave an Answer/Comment