Memory management

Memory management is a form of resource management applied to computer memory . The essential requirement of memory management is to provide a dynamic response to requests for reuse when no longer needed. This is critical to-any advanced computer system Where more than a single process might be Underway at Any Time. [1]

Several methods have been devised that increase the effectiveness of memory management. Virtual memory systems separate the memory addresses used by a process from actual physical addresses, Allowing separation of Processes and Increasing the size of the virtual address space beyond the available amount of RAM using paging or swapping to secondary storage . The quality of the virtual memory manager can have an extensive effect on overall system performance.


Modern general purpose computer systems

  • operating system level, and
  • application level.

Operating system

Main articles: memory management and memory management unit

Address translation


Application-level memory management is generally categorized as automatic memory management, usually involving garbage collection , or manual memory management .

Dynamic memory allocation

An example of external fragmentation
See also: C dynamic memory allocation

The task of fulfilling an allocation request consists of locating a block of unused memory of sufficient size. Memory requests are made by allocating portions from a large pool of memory called the heap or free store . [a] At any given time, some parts of the world are in use, while some are “free” (available) and thus available for future allocations.

Several issues which are incompatible with the implementation of such fragmentation , where they are many small spaces between allocated memory blocks, which invalidates their use for an allocation request. The allocator’s metadata can also inflate the size of (individually) small allocations. This is often managed by chunking . The memory management system must track outstanding allowances to Ensure That They Do not overlap and That no memory is ever “lost” as a memory leak .


The specific dynamic memory allocation algorithm implemented can impact performance significantly. A study conducted in 1994 by the Digital Equipment Corporation, the overheads involved for a variety of allocators. The lowest average instruction path is required to allocate a single memory slot was 52 (as measured with an instruction level profiler on a variety of software). [2]


Since the precise location of the allocation is not known in advance, the memory is usually accessed, usually through a reference point . The specific algorithm is used to allocate and allocate and deallocate chunks is interlinked with the kernel , and

Fixed-size blocks allocation
Main article: Memory pool

Fixed-size block allocation, also called memory pool allocation, uses a free list of fixed-size blocks of memory (often all of the same size). This works well for simple embedded systems , but suffers from fragmentation , especially with long memory addresses. HOWEVER, due to the Significantly Reduced overhead this method can Substantially Improve Performance for objects That need frequent allocation / de-allocation and is Often used in video games .

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

In this system, memory is allocated to multiple pools of memory instead of one, where each pool represents blocks of memory of a certain power of two in size, or blocks of some other convenient size progression. All blocks of a Particular size are kept in a sorted linked list or treeand all new blocks that are formed during allocation to their respective memory pools for later use. If a smaller size is requested than is available, the size is selected and split. One of the following is selected, and the process repeats until the request is complete. When a block is allocated, the allocator will start with the smallest large block to avoid needlessly breaking blocks. When a block is freed, it is compared to its buddy. If they are both free, they are combined and placed in the correspondingly larger-sized buddy-block list.

Slab allocation
Main article: Slab allocation
This section needs expansion . You can help by adding to it . (November 2016)
Stack allocation
Main article: Stack-based memory allocation
This section needs expansion . You can help by adding to it . (November 2016)

Automatic variables

Main article: Automatic variable

In many programming language implementations, all variables declared within a procedure (subroutine, or function) are local to that function; the runtime environment for the program automatically allocates memory for these variables on the program execution entry to the procedure, and automatically releases that memory when the procedure is exited. Special declarations may allow local variables to be retained between invocations of the procedure, or may allow local variables to be accessed by other procedures. The automatic allocation of local variables makes possible recursion , to a depth limited by available memory.

Garbage collection
Main article: Garbage collection (computer science)

Garbage collection is a strategy that is used in a program, and returns to a pool of free memory rentals. This method is in contrast to “manual” in the program. Some types of memory bugs, garbage collection, and the use of memory appliances.

Systems with virtual memory

Main articles: Memory protection and Shared memory (interprocess communication)

Virtual memory is a method of decoupling the memory organization from the physical hardware. The applications operate memory via virtual addresses . Each time an attempt to access stored data is made, the virtual address of a physical address . In this way, you can add granular control over memory systems and methods of access.

In the virtual memory systems, the operating system limits the process of accessing the memory. This feature, referred to as memory protection , may be used in a process that is not allocated to it.

Even though the memory allocated for specific processes is usually isolated, Shared memory is one of the fastest techniques for inter-process communication .

Memory is usually classified by access to primary storage and secondary storage . Memory management systems, among other operations, also handles the moving of information between these two levels of memory.

See also

  • Computer science portal
  • Dynamic array
  • Out of memory


  1. Jump up^ Not to be confused with the unrelatedheapdata structure.


  1. Jump up^ Gibson, Steve (August 15, 1988). “Tech Talk: Placing the IBM / Microsoft XMS Spec Into Perspective” . InfoWorld .
  2. Jump up^ Detlefs, D .; Dosser, A .; Zorn, B. (June 1994). “Memory allocation costs in large C and C ++ programs” (PDF) . Software: Practice and Experience . 24 (6): 527-542. CiteSeerX  . doi : 10.1002 / spe.4380240602 .


  • Donald Knuth . Fundamental Algorithms , Third Edition. Addison-Wesley, 1997. ISBN  0-201-89683-4 . Section 2.5: Dynamic Storage Allocation, pp. 435-456.
  • Simple Memory Allocation Archived Algorithms March 5, 2016 at the Wayback Machine . (originally published on OSDEV Community)
  • Wilson, PR; Johnstone, MS; Neely, M .; Boles, D. (1995). “Dynamic storage allocation: A survey and critical review”. Memory Management . Reading Notes in Computer Science. 986 . pp. 1-116. CiteSeerX  . doi : 10.1007 / 3-540-60368-9_19 . ISBN  978-3-540-60368-9 .
  • Berger, ED; Zorn, BG; McKinley, KS (June 2001). “Composing High-Performance Memory Allocators”. Proceedings of the ACM SIGPLAN 2001 conference on Language Programming and Implementation (PDF) . pp. 114-124. CiteSeerX  . doi : 10.1145 / 378795.378821 . ISBN  1-58113-414-2 .
  • Berger, ED; Zorn, BG; McKinley, KS (November 2002). “Reconsidering Custom Memory Allocation”. Proceedings of the 17th ACM SIGPLAN conference on Object-Oriented Programming, Systems, Languages, and Applications (PDF) . pp. 1-12. CiteSeerX  . doi : 10.1145 / 582419.582421 . ISBN  1-58113-471-1 .

Leave a Reply

Your email address will not be published. Required fields are marked *

Copyright 2019
Shale theme by Siteturner