I didn't understand that in dma ,are we required to have an initial guess of the memory needed or the calloc function allocates it as we need more of it i.e; what if our guess was not correct?
Dynamic memory allocation in C
Collapse
X
-
Tags: None
-
You aren't required to "have a guess". You are required to know exactly how much memory you require.
If you don't know how much you need right now then either
- You are trying to allocate memory too early
- You know you need X bytes now you might need more later. Then allocate X bytes and set your data structures up so that later you can allocate more if required.
Comment