|
Dynamic memory allocation - Definition and Overview |
| Related Words: Apportionment, Appropriation, Arrangement, Array, Assignment, Attribution, Collation, Collocation, Constitution, Denomination, Deployment, Deposit, Deposition, Distribution, Form, Formation |
|
|
- This article or section should be merged with Memory allocation
- This article or section should include material from Heap-based memory allocation
Dynamic memory allocation is the allocation of memory storage for use in a computer program during the runtime of that program. Memory is typically allocated from a large pool of all available unused memory called the heap, but may also be allocated from multiple pools. A dynamically allocated object remains allocated until it is deallocated explicitly, either by the programmer or by a garbage collector; this is notably different from automatic and static memory allocation. We say that such an object has dynamic lifetime.
The problem of fulfilling an allocation request, which involves finding a block of unused memory of a certain size in the heap, is a difficult problem. A wide variety of solutions have been proposed, including:
The main problem for most dynamic memory allocation algorithms is to avoid both internal and external fragmentation while keeping both allocation and deallocation efficient. Also, most algorithms in use have the problem that a large number of small allocations can cause wasted space due to collecting metadata; thus most programmers avoid this, sometimes by using a strategy called chunking.
Language support
Dynamic allocation of some kind is supported in almost every mainstream programming language. The malloc function is used to dynamically allocate memory in C. A new operator or keyword is used to dynamically allocate memory in Ada, C++, Pascal and Java.
|
|
Example Usage of allocation |
 |
KenFaulkenberry: The Arbor Asset allocation Model Portfolio (AAAMP) is at another ALL-TIME high up +20% (ytd) and 119% for the decade. (11/25/2009) |
 |
hellogoodnights: WTF 12:06 and allocation STILL NOT OUT? |
 |
hellogoodnights: AHH 12 AM OMGGGGG!!!! SUBJ COMBI allocation NOWZ?! |
|