What is a dynamic memory allocation?

Dynamic memory allocation, also called HEAP -based memory, is a type of memory management that is sharply contrasted by static memory allocation. When allocating the dynamic memory, the programmer tells the computer exactly how much memory for each program and how long the memory holds. This solves many problems that occur in the allocation of static memory, such as overuse of memory and stopped programs. Although it solves many problems, if the programmer forgets to say the memory to be discarded, then dynamic memory can become a problem.

Computer, use Static Memory Assignment by default. This means that memory is held by programs when used even if the program is no longer used or if the maintenance memory becomes dangerous or obstacle to performance. For example, if a user stops running a program that takes 2 megabytes (MB) on a 3 MB computer, and the second program needs 2 MB, the second program won't work. This is because there is no enaugh memory remaining in conceiveAci for the second program.

When assigning a static memory, a user or programmer cannot specify the amount of memory he wants, nor cannot the programmer communicate static memory to release the memory to release the resources. Therefore, advanced users often use dynamic memory assignment. The programmer is able to control everything about memory, including how long the resources hold.

For example, a programmer can set a dynamic memory assignment to keep only 1 MB or less, saving enough system memory to open other programs. This can be done because static memory usually holds everything about the program, while dynamic memory allows programmers to set it to a lower value that contains some data but not everything. At the same time, static memory will still be needed and can be set in this scheme of allocation.

potential problem with dynamic aloMemory Association - the one that rarely enters the game - is that dynamic memory can be filled in if the programmer forgets to set the time value. If no time value is set, unlike static memory, which eventually releases memory, dynamic memory will hold information. If the program has a garbage dump application and most do it, it will activate after some time to clean the memory. It is still the best practice to determine the time value for memory assignment.

IN OTHER LANGUAGES

Was this article helpful? Thanks for the feedback Thanks for the feedback

How can we help? How can we help?