BookRags.com Literature Guides Literature
Guides
Criticism & Essays Criticism &
Essays
Questions & Answers Questions &
Answers
Lesson Plans Lesson
Plans
My Bibliography Periodic Table U.S. Presidents Shakespeare Sonnet Shake-Up
Research Anything:        
History | Encyclopedias | Films | News | Create a Bibliography | More... Login | Register | Help
Not What You Meant?  There are 27 definitions for DMA.  Also try: DSA or Heap.

Dynamic memory allocation

Print-Friendly
About 2 pages (527 words)
Dynamic memory allocation Summary

Bookmark and Share Questions on this topic? Just ask!

In computer science, dynamic memory allocation is the allocation of memory storage for use in a computer program during the runtime of that program. It is a way of distributing ownership of limited memory resources among many pieces of data and code. Importantly, a dynamic allocation exists until it is explicitly released, either by the programmer or by a garbage collector; this is notably different from automatic and static memory allocation, which have a fixed duration. It is said that an object so allocated has dynamic lifetime.

Contents

Details

The task of fulfilling an allocation request, which involves finding a block of unused memory of sufficient size, is complicated by the need to avoid both internal and external fragmentation while keeping both allocation and deallocation efficient. Also, the allocator's metadata can inflate the size of (individually) small allocations; chunking attempts to reduce this effect. Usually, memory is allocated from a large pool of unused memory area called the heap (also called the free store). Since the precise location of the allocation is not known in advance, the memory is accessed indirectly, usually via a reference. The precise algorithm used to organize the memory area and allocate and deallocate chunks is hidden behind an abstract interface and may use any of the methods described below.

Implementations

Fixed-size-blocks allocation

This scheme uses a free list of fixed-size blocks of memory (often all of the same size). This works well for simple embedded systems.

Buddy blocks

For more details on this topic, see Buddy memory allocation.

In this system, memory is allocated from a large block of memory that is a power of two in size. If the block is more than twice as large as desired, it is broken in two. One of the halves is selected, and the process repeats (checking the size again and splitting if needed) until the block is just large enough. All the blocks of a particular size are kept in a sorted linked list or tree. When a block is freed, it is compared to its buddy. If they are both free, they are combined and placed in the next-largest size buddy-block list. (When a block is allocated, the allocator will start with the smallest sufficiently large block avoiding needlessly breaking blocks) Buddy block allocators are used both in real-time operating systems and in general-purpose operating systems (such as Microsoft Windows and Linux).

References

External links

See also

View More Summaries on Dynamic memory allocation
More Information
  • View Dynamic memory allocation Study Pack
  • 27 Alternative Definitions
  • Search Results for "Dynamic memory allocation"
  • Add This to Your Bibliography
  • More Products on This Subject
    Allocation/Deallocation of Memory
    Memory is essential for the functioning of a computer—for programs to load and run, and for information to be generated and stored in a retrievable format. The allocation and deallocation of memory by a memory allocator is essential for efficient p... more


     
    Ask any question on Dynamic memory allocation and get it answered FAST!
    Answer questions in BookRags Q&A and earn points toward
    discounted or even FREE Study Guides and other BookRags products!
    Learn more about BookRags Q&A
    Copyrights
    Dynamic memory allocation from Wíkipedia. ©2006 by Wíkipedia. Licensed under the GNU Free Documentation License. View a list of authors or edit this article.

    Article Navigation
    Join BookRagslearn moreJoin BookRags




    About BookRags | Customer Service | Report an Error | Terms of Use | Privacy Policy