Hi I have doubts about dynamic and static memory managment I
Hi,
I have doubts about dynamic and static memory managment,
I don\'t understand the difference, can anyone help me out,,, I found this in a paper, I need a clarification in simple words.
Thanks
Solution
Static Memory: Static Memory devices are semiconductor memories in which the stored data will remain permanently stored as long as power is applied without the need of periodically rewriting or refreshing the data into the memory. The basic element of this storage is a flip flop or a gate. SRAM, Punched Card and Tape are examples of Static Memory.
Dynamic Memory: Dynamic Memory devices are semiconductor memories in which the stored data will not remain permanently stored, even with power applied unless the data is periodically rewritten into the memory. Data is stored as charge on capacitors. The charge on capacitor has to be periodically refeshed in order to prevent it from leaking away. DRAM & Charge Coupled Device (CCD) are example of Dynamic Memory.
Static Allocation means, that the memory for your variables is automatically allocated, either on theStack or in other sections of your program. You do not have to reserve extra memory using them, but on the other hand, have also no control over the lifetime of this memory. E.g: a variable in a function, is only there until the function finishes.
Dynamic memory allocation is a bit different. You now control the exact size and the lifetime of these memory locations. If you don\'t free it, you\'ll run into memory leaks, which may cause your application to crash, since it, at some point cannot allocation more memory.
