answersLogoWhite

0


Best Answer

Dynamic memory allocation is the responsibility of the application. In traditional programming languages such as C, the application must call the malloc()/free() API (or use the new and delete operators in C++) to allocate and return memory dynamically.

More modern languages provide more transparent means of automatic memory allocation. Those are less error prone but can be less memory efficient, leaving the decisions about explicit allocation and return with the runtime system, rather than relying on explicit calls from the application.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Who is responsible for memory allocation while dynamic allocation of memory is done?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Difference between dynamic and static memory allocation?

Static memory allocation is memory allocated on the "stack" and cannot be resized after the initial allocation, while dynamic memory allocation is memory allocated in the "heap", and can be dynamically expanded and shrunk as necessary.


Difference between dynamic and static memory?

dynamic is the study of motin,while static is at rest it means that the memory which is used at motin time as by usic calloc,mallaoc,free function ,on the other hand static is the memory which only used at compile time or at the time of work in during progrmming,static memory has drawback ,the drawback is that in this memory ware unable to use the excess memory as we allocate already to cover or improvre this type of problem we use dynamic memory allocation.


Who allocates the memory?

Allocation is performed by OS while memory detection is done by BIOS.


How is partitioned allocation different from relocatable partitioned allocation?

Partitioned allocation is a fixed memory allocation technique which memory spaces are divided into smaller fixed partition, while Relocatable partitioning use variable and repartitioning technique


What is the role of heap in the dynamic memory allocation?

memory allocation has two types : static and dynamic 1) the static are for the data types that will never change in size during the program execution suxh as integers (1 and 1000 will take the same size if we declare them to have the same type). 2) while another data types such as arrays and lists , will grow and shrink during execution time (due to the addition and removing) . the HEAP is the part of the memory where such data (in part 2) are allocated.


What is static and dynamic memory?

A computer is built to contain two kinds of memory. There is static memory, which stays in the computer after it is powered off. Then there is dynamic memory, which is memory that is only accessible while the computer is on. The hard drive is an example of static memory, while RAM is an example of dynamic memory.


What do you understand by static memory allocation and dynamic memory allocation?

MEMORY ALLOCATION MODELS……STATIC MEMORY ALLOCATION DYNAMIC MEMORY ALLOCATIONMemory is allocated before the execution of the program begins.(During Compilation)Memory is allocated during the execution of the program.No memory allocation or deallocation actions are performed during Execution.Memory Bindings are established and destroyed during the Execution.Variables remain permanently allocated.Allocated only when program unit is active.Implemented using stacks and heaps.Implemented using data segments.Pointer is needed to accessing variables.No need of Dynamically allocated pointers.Faster execution than Dynamic.Slower execution than static.More memory Space required.Less Memory space required.


What is the difference between static memory versus dynamic memory?

Dynamic memory can be declared at run-time using the new and delete operators (or malloc and free in C), while static memory must be declared at compile-time.


Static and dynamic memory allocation in c plus plus?

dynamic memory allocation is that type of memory which create to allocate the memory on running time or at compile time by the function of malloc , calloc , realloc and free. dynamic memory allocation is give the best utilization of memory which gives the sufficient use of memory.


What are the advantages and disadvantages of dynamic memory allocation and the allocation of files in secondary storage?

Two disadvantages of dynamic allocation: a) Freeing memory b) FragmentationFreeing MemoryThe user is responsible for freeing up memory when he is finished with it. This is a serious responsibility, a potential source of bugs that are very hard to find. For example, suppose you free up a location before you're actually finished with it. Then further access to the location will either cause a run-time error (memory violation) or, what is worse (but more common), you will get access to a location that is being used for some completely unrelated purpose.Trouble also occurs if you forget to free up some space. If you do this, you are losing the advantages of dynamic allocation. And in some circumstances - e.g. if you were writing the program that manages the space on a disk drive - this could be disastrous.There are no surefire safeguards against these problems, you must be very careful when writing programs to return memory when you are finished with it, but not before.Fragmentation of MemoryAs the preceding example demonstrated, with dynamic allocation the `free' parts of memory are not all together in one contiguous block. When we returned JOE's memory, we had 4 free cells on one side of MARYJANE and all the rest on the other side. This is called fragmentation of memory, and it can grow into a very serious problem: it is possible to have a large amount of free memory but for it to be broken up into such tiny fragments that there is not enough contiguous free space to store another name. Suppose that after using dynamic allocation for a while memory becomes fragmented thus:and that we need to obtain a block this big: If only the remaining free blocks were contiguous, we'd have enough room, but, in the present configuration, it looks like we are doomed. There are several possible solutions to this problem. The one we will study is based on the insight that a large data structure does not necessarily have to be allocated in one single contiguous chunk of memory. Instead it might be decomposed into smaller components that are somehow linked together in a chain.


Difference between static array and dynamic array?

Dynamic memory allocation is at runtime. static memory allocation is before run time, but the values of variables may be changed at run time. Static memory allocation saves running time, but can't be possible in all cases. Dynamic memory allocation stores it's memory on heap, and the static memory allocation stores it's data in the "data segment" of the memory.


What are dynamic memory allocation advantages?

Often an application needs additional memory for the temporary storage of data. For example, the C programming language allows the programmer to use the MALLOC (memory allocate) function to grab a chunk of memory suitable for the applications needs. Failure to release the memory after it is used by using the FREE function can result in problems. It is called dynamic memory allocation because the memory is allocated at run-time, as needed. Unlike variables created within functions - the memory is not allocated on the processor stack, instead, when using MALLOC or the 'new' keyword, memory is allocated in the applications virtual address space.