Post · 18 min read· pp. 110–120

Memory Management Glossary: M

A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z

machine word : See

code
[word](/u/355fa8e73e689b3a#term-word).

main memory : Also known as

code
*memory*, *primary storage*.

The *main memory* (or *primary storage*) of a computer is
[memory (1)](#term-memory-1) that is wired directly to the processor,
consisting of [RAM](/u/611c5a77bde93a2f#term-ram) and possibly [ROM](/u/611c5a77bde93a2f#term-rom).

These terms are used in contrast to mass storage devices and
[cache memory](/u/b107b7d39b75ccb0#term-cache-memory) (although we may note that when a program
accesses main memory, it is often actually interacting with a
cache).

Main memory is the middle level of the [memory
hierarchy](#term-memory-hierarchy): it is slower and cheaper than [caches (1)](/u/b107b7d39b75ccb0#term-cache-1),
but faster and more expensive than [backing store](/u/4c6aaf4e0e0b7eb6#term-backing-store).

It is common to refer only to the main memory of a computer;
for example, “This server has 128 GB of memory” and “macOS
High Sierra requires at least 2 GB of memory”.

Historical note

Main memory used to be called [core](/u/b107b7d39b75ccb0#term-core), and is now
likewise often called [RAM](/u/611c5a77bde93a2f#term-ram).

Similar terms

[core](/u/b107b7d39b75ccb0#term-core), [physical memory (1)](/u/5195e3271b5de55e#term-physical-memory-1), [RAM](/u/611c5a77bde93a2f#term-ram).

malloc : A function in the standard C library that performs dynamic allocation of memory (2).

code
Many people use “malloc” as a verb to mean “allocate
dynamically”.

Similar term

[allocate](/u/9b03e2fad7c35ce0#term-allocate).

Opposite term

[free (2)](/u/b18026a6b8cfa4c8#term-free-2).

manual memory management : In some systems or languages, it is up to the application program to manage all the bookkeeping details of allocating memory (2) from the heap and freeing it when no longer required; this is known as manual memory management.

code
Manual memory management may be appropriate for small
programs, but it does not scale well in general, nor does it
encourage modular or object-oriented programming.

To quote [Joyner (1996)](/u/80406cde1a6844cf#joyner96):

> In C++ the programmer must manually manage storage due to
> the lack of [garbage collection](/u/9334865be20dfda3#term-garbage-collection). This is the most
> difficult bookkeeping task C++ programmers face, that
> leads to two opposite problems: firstly, an object can be
> [deallocated](/u/b18026a6b8cfa4c8#term-free-1) prematurely, while valid
> [references](/u/611c5a77bde93a2f#term-reference) still exist ([dangling
> pointers](/u/433f84a577790d37#term-dangling-pointer)); secondly, [dead](/u/433f84a577790d37#term-dead) objects might not be
> deallocated, leading to memory filling up with dead
> objects ([memory leaks](#term-memory-leak)). Attempts to correct either
> problem can lead to overcompensation and the opposite
> problem occurring. A correct system is a fine balance.

Historical note

Manual memory management was common in early languages,
but [garbage collection](/u/9334865be20dfda3#term-garbage-collection) has been around since the
late 1950s, in languages like [Lisp](/u/884599c4278a5039#term-lisp). Most modern
languages use [automatic memory management](/u/9b03e2fad7c35ce0#term-automatic-memory-management), and
some older languages have [conservative garbage
collection](/u/b107b7d39b75ccb0#term-conservative-garbage-collection) extensions.

Opposite term

[automatic memory management](/u/9b03e2fad7c35ce0#term-automatic-memory-management).

In the MPS

Manual memory management can be used with [pools](/u/5195e3271b5de55e#term-pool)
such as [MVFF (Manual Variable First Fit)](https://www.ravenbrook.com/project/mps/master/manual/html/pool/mvff.html#pool-mvff) via the functions
[`mps_alloc()`](https://www.ravenbrook.com/project/mps/master/manual/html/topic/allocation.html#c.mps_alloc) and [`mps_free()`](https://www.ravenbrook.com/project/mps/master/manual/html/topic/allocation.html#c.mps_free).

mapped : Also known as

code
*committed*.

A range of [virtual addresses](/u/9b6672e5a107d609#term-virtual-address) is said
to be *mapped* (*committed* on Windows) if there is
[physical memory (2)](/u/5195e3271b5de55e#term-physical-memory-2) associated with the range.

Note that, in some circumstances, the [virtual memory](/u/9b6672e5a107d609#term-virtual-memory)
system could actually [overcommit](/u/f63e411ec871b42a#term-overcommit) mapped memory.

Opposite term

[unmapped](/u/ced5e8494ccaae80#term-unmapped).

See also

[mapping](#term-mapping), [memory mapping](#term-memory-mapping), [mmap](#term-mmap).

In the MPS

The term *committed* is used. The function
[`mps_arena_committed()`](https://www.ravenbrook.com/project/mps/master/manual/html/topic/arena.html#c.mps_arena_committed) returns the total committed
memory for an [arena](/u/9b03e2fad7c35ce0#term-arena).

mapping : A mapping is a correspondence between a range of virtual addresses and some memory (1) (or a memory-mapped object). The physical location of the memory will be managed by the virtual memory system.

code
Each [page](/u/5195e3271b5de55e#term-page) in a mapping could be [paged out](/u/5195e3271b5de55e#term-paged-out) or
[paged in](/u/5195e3271b5de55e#term-paged-in), and the locations it occupies in [main
memory](#term-main-memory) and/or [swap space](/u/699ff3e2d070663d#term-swap-space) might change over time.

The [virtual address space](/u/9b6672e5a107d609#term-virtual-address-space) can contain of a complex set
of mappings. Typically, parts of the address space are
[mapped](#term-mapped) (have a mapping assigned), others are
[reserved](/u/611c5a77bde93a2f#term-reserved) but unmapped, and most of it is entirely
[unmapped](/u/ced5e8494ccaae80#term-unmapped).

![Diagram: Virtual memory with different kinds of mappings.](https://cdn.archive.preserve.ng/img/7660e8d3bd01ad3d82f75b7f15afe4dee58ce7e59b8772cf519fb928d363e632.svg)

*Virtual memory with different kinds of mappings.*

See also

[backing store](/u/4c6aaf4e0e0b7eb6#term-backing-store).

mark-compact : Mark-compact collection is a kind of tracing garbage collection that operates by marking reachable objects, then compacting the marked objects (which must include all the live objects).

code
The mark phase follows [reference](/u/611c5a77bde93a2f#term-reference) chains to mark all
reachable objects; the compaction phase typically performs a
number of sequential passes over [memory (2)](#term-memory-2) to move
objects and update references. As a result of compaction, all
the marked objects are moved into a single contiguous
[block](/u/4c6aaf4e0e0b7eb6#term-block) of memory (or a small number of such blocks);
the memory left unused after compaction is [recycled](/u/611c5a77bde93a2f#term-recycle).

Mark-compact collection can be regarded as a variation of
[mark-sweep collection](#term-mark-sweep), with extra effort
spent to eliminate the resulting [fragmentation](/u/b18026a6b8cfa4c8#term-fragmentation).
Compaction also allows the use of more efficient
[allocation mechanisms](/u/9b03e2fad7c35ce0#term-allocation-mechanism), by
making large free blocks available.

Related publication

[Edwards](/u/80406cde1a6844cf#edwards).

mark-sweep

mark-and-sweep : Mark-sweep collection is a kind of tracing garbage collection that operates by marking reachable objects, then sweeping over memory (2) and recycling objects that are unmarked (which must be unreachable), putting them on a free list.

code
The mark phase follows [reference](/u/611c5a77bde93a2f#term-reference) chains to mark all
reachable objects; the sweep phase performs a sequential
([address](/u/9b03e2fad7c35ce0#term-address)-order) pass over memory to recycle all
unmarked objects. A mark-sweep [collector (1)](/u/b107b7d39b75ccb0#term-collector-1) doesn’t
move objects.

Historical note

This was the first garbage collection algorithm, devised
by John McCarthy for [Lisp](/u/884599c4278a5039#term-lisp).

See also

[mark-compact](#term-mark-compact).

Related publication

[McCarthy (1960)](/u/80406cde1a6844cf#mccarthy60).

marking : Marking is the first phase (“the mark phase”) of the mark-sweep algorithm or mark-compact algorithm. It follows all references from a set of roots to mark all the reachable objects.

code
Marking follows [reference](/u/611c5a77bde93a2f#term-reference) chains and makes some sort
of mark for each object it reaches.

Marking is often achieved by setting a bit in the object,
though any conservative representation of a predicate on the
[memory location](#term-memory-location) of the object can be used. In
particular, storing the mark bit within the object can lead to
poor [locality of reference](/u/34ad814de80e6063#term-locality-of-reference) and to poor cache
performance, because the marking phases ends up setting the
[dirty bit](/u/433f84a577790d37#term-dirty-bit) on all [pages](/u/5195e3271b5de55e#term-page) in the [working
set](/u/355fa8e73e689b3a#term-working-set). An alternative is to store the mark bits separately:
see [bitmap marking](/u/4c6aaf4e0e0b7eb6#term-bitmap-marking).

See also

[compact](/u/b107b7d39b75ccb0#term-compaction), [sweep](/u/699ff3e2d070663d#term-sweeping).

MB : See

code
[megabyte](#term-megabyte).

megabyte : Also known as

code
*MB*.

A megabyte is 1024 [kilobytes](/u/582bb619f9d3b4b6#term-kilobyte), or 1048576
[byte (1)](/u/4c6aaf4e0e0b7eb6#term-byte-1).

See [byte (1)](/u/4c6aaf4e0e0b7eb6#term-byte-1) for general information on this and
related quantities.

memoization : See

code
[caching (3)](/u/b107b7d39b75ccb0#term-caching-3).

memory(1) : Also known as

code
*storage*, *store*.

*memory* or *storage* (or *store*) is where data and
instructions are stored. For example, [caches (1)](/u/b107b7d39b75ccb0#term-cache-1), [main memory](#term-main-memory), floppy and hard disks are
all storage devices.

These terms are also used for the capacity of a system to
store data, and may be applied to the sum total of all the
storage devices attached to a computer.

Historical note

“Store” is old-fashioned, but survives in expressions such
as “[backing store](/u/4c6aaf4e0e0b7eb6#term-backing-store)”.

memory(2) : Memory refers to memory (1) that can be accessed by the processor directly (using memory addressing instructions).

code
This could be [real memory (1)](/u/611c5a77bde93a2f#term-real-memory-1) or [virtual memory](/u/9b6672e5a107d609#term-virtual-memory).

memory(3) : See

code
[main memory](#term-main-memory).

memory(4) : A memory location; for example, “My digital watch has 256 memories.”

memory bandwidth : Memory bandwidth (by analogy with the term bandwidth from communication theory) is a measure of how quickly information (expressed in terms of bits) can be transferred between two places in a computer system.

code
Often the term is applied to a measure of how quickly the
processor can obtain information from the [main memory](#term-main-memory)
(for example, “My new bus design has a bandwidth of over 400
Megabytes per second”).

memory cache : See

code
[cache (1)](/u/b107b7d39b75ccb0#term-cache-1).

memory hierarchy : See

code
[storage hierarchy](/u/699ff3e2d070663d#term-storage-hierarchy).

memory leak : Also known as

code
*leak*, *space leak*, *space-leak*.

A memory leak is where [allocated](/u/9b03e2fad7c35ce0#term-allocate) [memory (2)](#term-memory-2) is
not [freed (1)](/u/b18026a6b8cfa4c8#term-free-1) although it is never used again.

In [manual memory management](#term-manual-memory-management), this usually occurs
because [objects](/u/f63e411ec871b42a#term-object) become [unreachable](/u/ced5e8494ccaae80#term-unreachable) without
being [freed (1)](/u/b18026a6b8cfa4c8#term-free-1).

In [tracing garbage collection](/u/f992775ea91d0285#term-tracing-garbage-collection), this happens when
objects are [reachable](/u/611c5a77bde93a2f#term-reachable) but not [live](/u/34ad814de80e6063#term-live).

In [reference counting](/u/611c5a77bde93a2f#term-reference-counting), this happens when objects are
[referenced](/u/611c5a77bde93a2f#term-reference) but not [live](/u/34ad814de80e6063#term-live). (Such objects may or
may not be [reachable](/u/611c5a77bde93a2f#term-reachable).)

Repeated memory leaks cause the memory usage of a process to
grow without bound.

memory location : Also known as

code
*location*.

Each separately-[addressable](/u/9b03e2fad7c35ce0#term-address) unit of
[memory (2)](#term-memory-2) in which data can be stored is called a
*memory location*. Usually, these hold a [byte (2)](/u/4c6aaf4e0e0b7eb6#term-byte-2), but
the term can refer to [words](/u/355fa8e73e689b3a#term-word).

memory management : Also known as

code
*storage management*.

Memory management is the art and the process of coordinating
and controlling the use of [memory (1)](#term-memory-1) in a computer
system.

Memory management can be divided into three areas:

1. Memory management hardware ([MMUs](#term-MMU),
   [RAM](/u/611c5a77bde93a2f#term-ram), etc.);
2. Operating system memory management ([virtual memory](/u/9b6672e5a107d609#term-virtual-memory),
   [protection](/u/5195e3271b5de55e#term-protection));
3. Application memory management ([allocation](/u/9b03e2fad7c35ce0#term-allocate), [deallocation](/u/b18026a6b8cfa4c8#term-free-1), [garbage
   collection](/u/9334865be20dfda3#term-garbage-collection)).

Memory management hardware consists of the electronic devices
and associated circuitry that store the state of a computer.
These devices include RAM, MMUs (memory management units),
[cache (1)](/u/b107b7d39b75ccb0#term-cache-1), disks, and processor
[registers](/u/611c5a77bde93a2f#term-register). The design of memory hardware is
critical to the performance of modern computer systems. In
fact, [memory bandwidth](#term-memory-bandwidth) is perhaps the main limiting
factor on system performance.

Operating system memory management is concerned with using the
memory management hardware to manage the resources of the
[storage hierarchy](/u/699ff3e2d070663d#term-storage-hierarchy) and allocating them to the various
activities running on a computer. The most significant part of
this on many systems is [virtual memory](/u/9b6672e5a107d609#term-virtual-memory), which
creates the illusion that every process has more memory than
is actually available. OS memory management is also concerned
with [memory protection](#term-memory-protection) and security, which help to
maintain the integrity of the operating system against
accidental damage or deliberate attack. It also protects user
programs from errors in other programs.

Application memory management involves obtaining [memory
(2)](#term-memory-2) from the operating system, and managing its use by an
application program. Application programs have dynamically
changing storage requirements. The application [memory
manager](#term-memory-manager) must cope with this while minimizing the total CPU
overhead, interactive pause times, and the total memory used.

While the operating system may create the illusion of nearly
infinite memory, it is a complex task to manage application
memory so that the application can run most efficiently.
Ideally, these problems should be solved by tried and tested
tools, tuned to a specific application.

The Memory Management Reference is mostly concerned with
application memory management.

See also

[automatic memory management](/u/9b03e2fad7c35ce0#term-automatic-memory-management), [manual memory management](#term-manual-memory-management).

Memory Management Unit : See

code
[MMU](#term-MMU).

memory manager : The memory manager is that part of the system that manages memory (2), servicing allocation requests, and recycling memory, either manually or automatically.

code
The memory manager can have a significant effect on the
efficiency of the program; it is not unusual for a program to
spend 20% of its time managing memory.

Similar terms

[allocator](/u/9b03e2fad7c35ce0#term-allocator), [collector (1)](/u/b107b7d39b75ccb0#term-collector-1).

See also

[memory management](#term-memory-management).

memory mapping : Also known as

code
*file mapping*.

*Memory mapping* is the technique of making a part of the
[address space](/u/9b03e2fad7c35ce0#term-address-space) appear to contain an “object”, such as a
file or device, so that ordinary [memory (2)](#term-memory-2) accesses
act on that object.

The object is said to be *mapped* to that range of addresses.
(The term “object” does not mean a program [object](/u/f63e411ec871b42a#term-object). It
comes from Unix terminology on the [mmap](#term-mmap) man page.)

![Diagram: An address space with a range mapped to part of an object.](https://cdn.archive.preserve.ng/img/9eb7cb375247ea018ef8b660b4c59e8d6ffd4a1c7db49a351a95d77df25743ed.svg)

*An address space with a range mapped to part of an object.*

Memory mapping uses the same mechanism as [virtual
memory](/u/9b6672e5a107d609#term-virtual-memory) to “trap” accesses to parts of the [address
space](/u/9b03e2fad7c35ce0#term-address-space), so that data from the file or device can be
[paged in](/u/5195e3271b5de55e#term-paged-in) (and other parts [paged out](/u/5195e3271b5de55e#term-paged-out)) before
the access is completed.

Historical note

File mapping is available on most modern Unix and Windows
systems. However, it has a much longer history. In
Multics, it was the primary way of accessing files.

See also

[mapped](#term-mapped).

memory protection : See

code
[protection](/u/5195e3271b5de55e#term-protection).

message : In the MPS

code
A data structure which the MPS uses to communicate with
the [client program](/u/b107b7d39b75ccb0#term-client-program). See [Messages](https://www.ravenbrook.com/project/mps/master/manual/html/topic/message.html#topic-message).

message queue : In the MPS

code
A queue of [messages](#term-message) posted by an
[arena](/u/9b03e2fad7c35ce0#term-arena). It can be queried by calling
[`mps_message_poll()`](https://www.ravenbrook.com/project/mps/master/manual/html/topic/message.html#c.mps_message_poll),
[`mps_message_queue_type()`](https://www.ravenbrook.com/project/mps/master/manual/html/topic/message.html#c.mps_message_queue_type), or
[`mps_message_get()`](https://www.ravenbrook.com/project/mps/master/manual/html/topic/message.html#c.mps_message_get). See [Messages](https://www.ravenbrook.com/project/mps/master/manual/html/topic/message.html#topic-message).

message type : In the MPS

code
A value of type [`mps_message_type_t`](https://www.ravenbrook.com/project/mps/master/manual/html/topic/message.html#c.mps_message_type_t) describing
the type of a [message](#term-message). There are three message
types: [`mps_message_type_finalization()`](https://www.ravenbrook.com/project/mps/master/manual/html/topic/finalization.html#c.mps_message_type_finalization),
[`mps_message_type_gc()`](https://www.ravenbrook.com/project/mps/master/manual/html/topic/collection.html#c.mps_message_type_gc), and
[`mps_message_type_gc_start()`](https://www.ravenbrook.com/project/mps/master/manual/html/topic/collection.html#c.mps_message_type_gc_start). See
[Messages](https://www.ravenbrook.com/project/mps/master/manual/html/topic/message.html#topic-message).

misaligned : See

code
[unaligned](/u/ced5e8494ccaae80#term-unaligned).

miss : A miss is a lookup failure in any form of cache (3), most commonly at some level of a storage hierarchy, such as a cache (1) or virtual memory system.

code
The cost of a miss in a virtual memory system is considerable:
it may be five orders of magnitude more costly than a hit. In
some systems, such as multi-process operating systems, other
work may be done while a miss is serviced.

Opposite term

[hit](/u/5696710a733ccf6f#term-hit).

See also

[miss rate](#term-miss-rate).

miss rate : At any level of a storage hierarchy, the miss rate is the proportion of accesses which miss.

code
Because misses are very costly, each level is designed to
minimize the miss rate. For instance, in [caches (1)](/u/b107b7d39b75ccb0#term-cache-1),
miss rates of about 0.01 may be acceptable, whereas in
[virtual memory](/u/9b6672e5a107d609#term-virtual-memory) systems, acceptable miss rates are much
lower (say 0.00005). If a system has a miss rate which is too
high, it will spend most of its time servicing the misses, and
is said to [thrash](/u/f992775ea91d0285#term-thrash).

Miss rates may also be given as a number of misses per unit
time, or per instruction.

Opposite term

[hit rate](/u/5696710a733ccf6f#term-hit-rate).

mmap : mmap is a system call provided on many Unix systems to create a mapping for a range of virtual addresses.

MMU : Also known as

code
*Memory Management Unit*.

The MMU (Memory Management Unit) is a hardware device
responsible for handling [memory (2)](#term-memory-2) accesses requested
by the main processor.

This typically involves translation of [virtual
addresses](/u/9b6672e5a107d609#term-virtual-address) to [physical addresses](/u/5195e3271b5de55e#term-physical-address), [cache (1)](/u/b107b7d39b75ccb0#term-cache-1)
control, bus arbitration, [memory protection](#term-memory-protection), and the
generation of various exceptions. Not all processors have an
MMU.

See also

[page fault](/u/5195e3271b5de55e#term-page-fault), [segmentation violation](/u/699ff3e2d070663d#term-segmentation-violation), [virtual memory](/u/9b6672e5a107d609#term-virtual-memory).

mostly-copying garbage collection : A type of semi-conservative tracing garbage collection which permits objects to move if no ambiguous references point to them.

code
The techniques used are a hybrid of [copying garbage
collection](/u/b107b7d39b75ccb0#term-copying-garbage-collection) and [mark-sweep](#term-mark-sweep).

Mostly-copying garbage collectors share many of the benefits
of copying collectors, including [compaction](/u/b107b7d39b75ccb0#term-compaction). Since
they support ambiguous references they are additionally
suitable for use with uncooperative compilers, and may be an
efficient choice for multi-threaded systems.

Related publications

[Bartlett (1989)](/u/80406cde1a6844cf#bartlett89), [Yip (1991)](/u/80406cde1a6844cf#yip91).

In the MPS

The [AMC (Automatic Mostly-Copying)](https://www.ravenbrook.com/project/mps/master/manual/html/pool/amc.html#pool-amc) pool class implements mostly-copying
garbage collection.

mostly-exact garbage collection : See

code
[semi-conservative garbage collection](/u/699ff3e2d070663d#term-semi-conservative-garbage-collection).

mostly-precise garbage collection : See

code
[semi-conservative garbage collection](/u/699ff3e2d070663d#term-semi-conservative-garbage-collection).

moving garbage collector

moving memory manager : A memory manager (often a garbage collector) is said to be moving if allocated objects can move during their lifetimes.

code
Relevance to memory management

In the garbage collecting world this will apply to
[copying](/u/b107b7d39b75ccb0#term-copying-garbage-collection) collectors
and to [mark-compact](#term-mark-compact) collectors. It may also refer
to [replicating](/u/611c5a77bde93a2f#term-replicating-garbage-collector)
collectors.

Similar term

[copying garbage collection](/u/b107b7d39b75ccb0#term-copying-garbage-collection).

Opposite term

[non-moving garbage collector](/u/79d1d3e473607e01#term-non-moving-garbage-collector).

mutable : Any object which may be changed by a program is mutable.

code
Opposite term

[immutable](/u/7010622dc3b8d8f9#term-immutable).

mutator : Also known as

code
*client program*.

In a [garbage-collected](/u/9334865be20dfda3#term-garbage-collection) system,
the part that executes the user code, which [allocates](/u/9b03e2fad7c35ce0#term-allocate) [objects](/u/f63e411ec871b42a#term-object) and modifies, or
*mutates*, them.

For purposes of describing [incremental garbage
collection](/u/7010622dc3b8d8f9#term-incremental-garbage-collection), the system is divided into the *mutator* and the
[collector (2)](/u/b107b7d39b75ccb0#term-collector-2). These can be separate threads of
computation, or interleaved within the same thread.

The user code issues allocation requests, but the allocator
code is usually considered part of the collector. Indeed, one
of the major ways of scheduling the other work of the
collector is to perform a little of it at every allocation.

While the mutator mutates, it implicitly [frees](/u/b18026a6b8cfa4c8#term-free-1) [memory (1)](#term-memory-1) by overwriting [references](/u/611c5a77bde93a2f#term-reference).

Historical note

This term is due to [Dijkstra et al. (1976)](/u/80406cde1a6844cf#dlmss76).

Opposite term

[collector (2)](/u/b107b7d39b75ccb0#term-collector-2).

In the MPS

The MPS documentation uses the term [client program](/u/b107b7d39b75ccb0#term-client-program)
to refer to the mutator.