answersLogoWhite

0


Best Answer

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.

User Avatar

Wiki User

โˆ™ 2009-05-12 21:01:39
This answer is:
๐Ÿ™
0
๐Ÿคจ
0
๐Ÿ˜ฎ
0
User Avatar
Study guides

๐Ÿ““
Create a Study Guide

Add your answer:

Earn +20 pts
Q: What is dynamic memory allocation?
Write your answer...
Submit
Related questions

What is the difference between dynamic memory allocation and static memory allocation?

The memory allocated at runtime is dynamic memory allocation and the memory allocated during coding is static memory allocation.


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.


Compare and contrast dynamic memory allocation and the allocation of files in secondary storage?

Static Memory Allocation: Allocating the total memory requirements that a data structure might need all at once without regard for the actual amount needed at execution time. Dynamic Memory Allocation: The opposite strategy of static memory allocation - Dynamic Memory Allocation, involves allocating memory as-needed.


Dynamic memory allocation in c?

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 is static memory allocation and dynamic memory allocation?

A Static memory allocation can be defined as a predefined memory allocation by the programmer independent and non-changable by the user during execution of the program but where as Dynamic memory allocation allows the user of the program to instruct the program,how much memory he needs,during run time...


What is difference in static and dynamic memory allocation?

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.


Advantages of dynamic memory allocation?

By using dynamic memory allocation we can prevent wastege of memory.


What are types of memory allocation?

There are two types of memory allocations. 1. Static memory allocation 2. Dynamic memory allocation


How do you display matrix in c using dynamic memory allocation?

Memory allocation is not necessary to display a matrix.


What is the use of Constructor with Dynamic allocation?

Constructors are necessary to initialize classes. It allows to avoid to a lot of problems with unauthorized access of memory. Dynamic allocation makes possible allocation of memory during execution of program. If you do not use dynamic allocation, all required memory will be allocated during initialization phase (constructors are usually responsible for that). But you can't use more memory. Dynamic allocation was designed to overcome such problems.


What Linked list uses.type of memory allocation?

Linked lists use dynamic memory allocation (also called "heap memory allocation", as the linked list is stored in heap memory).


What are the problem associated with dynamic memory allocation?

Not freeing it when you no longer need the memory.


At what time the memory is allocated for variable in c and c?

Static memory allocation occurs at compile time where as dynamic memory allocation occurs at run time.


What is the special features of pointers in c?

Dynamic memory allocation


What is segmented page allocation?

Segmented page allocation is a type of memory management that uses base and bound registers to determine memory faults, similar to dynamic page allocation. More importantly it is different to dynamic page allocation since the entire process doesn't have to be in memory, similar to using virtual memory paging where the program is broken into pieces. Unlike virtual memory paging, the maximum virtual memory size is limited to the size of physical memory.


Why dynamic memory allocation is used?

In dynamic programming what amount of memory is needed by the programmer are allocated to it dynamically i.e at the run time so that wastage of memory can be avoided.


What is difference in static and dynamic storage allocation?

Static storage allocation is when a program dedicates an amount of memory for its use at the start of the program. Dynamic storage allocation is when a program only takes storage as it needs it.


What is the maximum size of memory available for dynamic memory allocation?

The maximum memory that can be dynamically allocated depends on the size of the heap memory. Dynamic blocks of memory can be allocated in system heap until it is not full.


What are the different function used for dynamic memory allocation?

alloc :- to allocate memory. calloc :- to free the memory.


How useful is dynamic memory allocation?

Dynamic memory allocation has its positive sides as well as drawbacks. It works great when you know how to manage memory. It allows you to reserve space in memory which can reused by other program or variable later on. Static variables will not allow you to do that. But you have to be careful working with memory allocation because you can try accessing part of the memory used by OS in most cases it will cause "blue screen" (windows).


What is dynamic memory allocation in data structure?

Dynamic memory allocation refers to the allocation of memory to an element at run-time. For eg: In linked lists, the number of elements held by the linked list is not known at compile time. Whenever the user requests to insert or delete an element from the list, memory is allocated/deallocated accordingly. For memory allocation in c, malloc, calloc and realloc functions are used while for deallocation, free is used.


Explain with memory diagram the concept of static and dynamic memory allocation?

Static memory is pre determined memory and has a fixed value in it ,while dynamic memory is allocated at run time by depending on the resources used.


Write a C program using dynamic memory allocation to add two matrices?

I want to make dynamic matrix multiplication


What are dynamic memory allocation advantages?

The advantage of dynamic over static memory allocation is twofold: first, it allows supporting applications and algorithms without predicting the exact amount of memory required for a particular problem. Such an algorithm can allocate the correct amount of memory at runtime, or "top up" the previously allocated memory, through dynamic memory allocation services. The second advantage is that the physical memory may be re-used over time: one algorithm may allocate a certain amount of memory at one time, return this memory to the heap later, and allocate another chunk of memory after this. The second allocation might re-use the same physical memory used with the first allocation.The disadvantage of dynamic over static memory allocation is also twofold: first, dynamic memory incurs an administrative overhead and can fragment, so it might be is less efficient than static allocation. Second, dynamic memory consists of allocating the right amount of memory at the right time, using it correctly, and returning it to the pool (typically called the heap) as soon as possible. Failure to do so can cause a memory leak, which can be the cause of severe problems affecting the entire computer.


Do you agree that dynamic memory allocation is more flexible and efficient than static memory allocation but slower than static memory allocation Justify your answer.?

Dynamic memory allocation is much more flexible because it allows programs running on a computer to request more memory when it is needed. Once it is no longer required it is returned to the operating system which can then give it to other programs that many need it. Ultimately dynamic memory allocation allows more programs to run on a computer as they only consume the memory they need rather that all of the memory they might ever need.Because memory has to be managed by the operating system, allocated, de-allocated and usually zero'ed for security reasons this all takes CPU cycles. However, this impact in modern hardware is trivial.