Memory Management Glossary: W
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
weak-key hash table : A hash table which has weak references (1) to its keys. If the key dies, the value for that key is automatically deleted from the table too. It can be used to store extra information about objects without keeping them alive.
Similar terms
[doubly weak hash table](/u/433f84a577790d37#term-doubly-weak-hash-table), [weak-value hash table](#term-weak-value-hash-table).
In the MPS
See [AWL (Automatic Weak Linked)](https://www.ravenbrook.com/project/mps/master/manual/html/pool/awl.html#pool-awl).weak-value hash table : A hash table which has weak references (1) to its value. If the value dies, any keys that refer to that value are automatically deleted from the table too. It can be used to index a set of objects without keeping them alive.
Similar terms
[doubly weak hash table](/u/433f84a577790d37#term-doubly-weak-hash-table), [weak-key hash table](#term-weak-key-hash-table).
In the MPS
See [AWL (Automatic Weak Linked)](https://www.ravenbrook.com/project/mps/master/manual/html/pool/awl.html#pool-awl).weak hash table : A weak-key or weak-value hash table (usually the former).
weak reference(1) : In tracing garbage collection, a weak reference is a reference that does not keep the object it refers to alive.
A weak reference does not keep the referent alive, but it will
continue to refer to the object as long as it remains
otherwise alive. When only weak references to the object
remain, the weak references can be deleted (“splatted” or
“cleared”) and the object [reclaimed](/u/611c5a77bde93a2f#term-reclaim).
[Java](/u/884599c4278a5039#term-java) offers three kinds of weak references, called
[soft references](/u/699ff3e2d070663d#term-soft-reference), [weak references (2)](#term-weak-reference-2), and
[phantom references](/u/5195e3271b5de55e#term-phantom-reference), in order of increasing weakness.
Opposite term
[strong reference](/u/699ff3e2d070663d#term-strong-reference).
See also
[weak root](#term-weak-root).weak reference(2)
: In Java terminology, weak reference is used to mean
a reference encapsulated in a reference object
of class WeakReference.
Weak references form one of three kinds of [weak
reference (1)](#term-weak-reference-1) in Java. They are handy for associating extra
data with objects when you cannot store it in the objects
themselves.
See also
[weakly reachable](#term-weakly-reachable).
Related links
[Class java.lang.ref.WeakReference](http://docs.oracle.com/javase/8/docs/api/java/lang/ref/WeakReference.html), [Reference Objects and Garbage Collection](http://pawlan.com/monica/articles/refobjs/).weak root : A weak root is a root, such that all references in it are weak references (1); that is, they do not affect the liveness of the objects referred to.
Opposite term
[strong root](/u/699ff3e2d070663d#term-strong-root).
In the MPS
A weak root has [rank](/u/611c5a77bde93a2f#term-rank) [`mps_rank_weak()`](https://www.ravenbrook.com/project/mps/master/manual/html/topic/root.html#c.mps_rank_weak).weak tri-color invariant
weak tri-colour invariant
weak tricolor invariant
weak tricolour invariant : The weak tri-color invariant is the property of a reference graph that all white nodes pointed to by a black node are also reachable from some gray node through a chain of white nodes.
By preserving this property throughout [tri-color
marking](/u/f992775ea91d0285#term-tri-color-marking), a [tracing](/u/f992775ea91d0285#term-trace) algorithm can ensure that
the [collector (2)](/u/b107b7d39b75ccb0#term-collector-2) will not miss reachable objects,
even if the [mutator](/u/367f5f45f9800ccb#term-mutator) manipulates the graph during the
collection. Mutator actions might need to change the
[color](/u/b107b7d39b75ccb0#term-color) of the nodes affected in order to preserve the
invariant.
Algorithms using this invariant are
[snapshot-at-the-beginning](/u/699ff3e2d070663d#term-snapshot-at-the-beginning)
algorithms.
See also
[barrier (1)](/u/4c6aaf4e0e0b7eb6#term-barrier-1), [strong tri-color invariant](/u/699ff3e2d070663d#term-strong-tri-color-invariant).
Related publications
[Johnstone (1997)](/u/80406cde1a6844cf#johnstone97), [Pirinen (1998)](/u/80406cde1a6844cf#pirinen98).weakly reachable : In Java, an object is weakly reachable if it is neither strongly nor softly reachable and there is a path from the roots to it that contains at least one weak reference (2) but no phantom references.
When the Java [collector (1)](/u/b107b7d39b75ccb0#term-collector-1) determines that an object
is weakly reachable, it clears all the weak references
involved, and declares the object [finalizable](/u/b18026a6b8cfa4c8#term-finalization). (Operationally, finalization works as if it
was implemented by a class of “final references” that stand
between weak and phantom references.) Also, the
[reference objects](/u/611c5a77bde93a2f#term-reference-object) containing the
weak references are enqueued, if they were registered with a
queue.
See also
[phantom reachable](/u/5195e3271b5de55e#term-phantom-reachable), [reachability](/u/611c5a77bde93a2f#term-reachable).
Related link
[Class java.lang.ref.WeakReference](http://docs.oracle.com/javase/8/docs/api/java/lang/ref/WeakReference.html), [Reference Objects and Garbage Collection](http://pawlan.com/monica/articles/refobjs/).weighted buddies : A buddy system allocation mechanism using two series of size classes: binary buddies (2, 4, 8, …) and three-times-power-of-two (3, 6, 12, …). A block that is in the latter series may be split in two different ways. Thus a block of size 12 may be split into two blocks of size 6 or one block of size 4 and one block of size 8. The same applies for coalescing. This gives this system more flexibility than a regular buddy system.
See also
[allocation mechanism](/u/9b03e2fad7c35ce0#term-allocation-mechanism), [binary buddies](/u/4c6aaf4e0e0b7eb6#term-binary-buddies), [buddy system](/u/4c6aaf4e0e0b7eb6#term-buddy-system).
Related publication
[Wilson et al. (1995)](/u/80406cde1a6844cf#wil95).weighted reference counting : A technique for reference counting which is in common use for distributed garbage collection because of the low level of inter-process communication it requires.
Inter-process [references](/u/611c5a77bde93a2f#term-reference) to [objects](/u/f63e411ec871b42a#term-object) are
counted, but instead of simply counting the number of
references, each reference is given a weight. When an object
is created, the initial pointer to it is assigned a weight,
which is usually a power of 2 for easy division. The object
records the sum of all the weights of all of its references.
Whenever a reference is copied, its weight is divided equally
between the new and original copies. Since this operation
preserves the weighted reference sum, there is no need for
communication with the object at this time. When a reference
is deleted, the weighted reference sum is decremented by the
weight of the reference. This is communicated to the object by
sending it a message. When the object detects that the
weighted reference sum has dropped to zero, it may be
[reclaimed](/u/611c5a77bde93a2f#term-reclaim). The algorithm is tolerant of communication
protocols which don’t guarantee order of arrival of deletion
messages.white : In a tri-color marking scheme, white objects are objects that were condemned at the beginning of the collection cycle and have not been shown to be reachable. When tracing is complete, white objects will be subject to reclamation.
Opposite terms
[black](/u/4c6aaf4e0e0b7eb6#term-black), [gray](/u/9334865be20dfda3#term-gray).word : Also known as
*machine word*.
Almost all processor architectures have a characteristic data
size that is handled most efficiently. This is known as the
*word size*, and data of that size are known as *words*. The
word size is usually a power of two multiple of [bytes
(2)](/u/4c6aaf4e0e0b7eb6#term-byte-2).
Often the platform’s word size is used to characterize the
architecture by quoting the number of bits in it. For example,
a 32-bit platform has a word size of four bytes and a 64-bit
platform has eight-byte words (assuming 8-bit bytes).
Typically, [pointers](/u/5195e3271b5de55e#term-pointer) are the size of a word,
and traditionally this determined the word size. Nowadays,
word size is usually driven by the need for more accuracy and
range in mathematical calculations.
Historical note
In the past, the convenience of dealing with powers of two was not as significant, and word sizes such as 36- or 72-bits were not unknown.
See also
[alignment](/u/9b03e2fad7c35ce0#term-alignment), [grain](/u/9334865be20dfda3#term-grain).working set : The working set of a program or system is that memory (2) or set of addresses which it will use in the near future.
This term is generally used when discussing [miss rates](/u/367f5f45f9800ccb#term-miss-rate)
at some [storage level](/u/699ff3e2d070663d#term-storage-level); the time scale of “near future”
depends upon the cost of a [miss](/u/367f5f45f9800ccb#term-miss). The working set
should fit in the storage level; otherwise the system may
[thrash](/u/f992775ea91d0285#term-thrash).
See also
[cache (2)](/u/b107b7d39b75ccb0#term-cache-2), [resident set](/u/611c5a77bde93a2f#term-resident-set), [storage hierarchy](/u/699ff3e2d070663d#term-storage-hierarchy).
Related publication
[Denning & Schwartz (1972)](/u/80406cde1a6844cf#ds72).worst fit : The allocation policy that always allocates from the largest free block. Commonly implemented using a size-ordered free block chain (largest first).
In practice, this tends to work quite badly because it
eliminates all large blocks, so large requests cannot be met.
See also
[allocation policy](/u/9b03e2fad7c35ce0#term-allocation-policy), [best fit](/u/4c6aaf4e0e0b7eb6#term-best-fit), [first fit](/u/b18026a6b8cfa4c8#term-first-fit).
Related publication
[Wilson et al. (1995)](/u/80406cde1a6844cf#wil95).wrapped : A value is wrapped if it is encoded with type information.
Opposite term
[unwrapped](/u/ced5e8494ccaae80#term-unwrapped).
See also
[boxed](/u/4c6aaf4e0e0b7eb6#term-boxed), [tag](/u/f992775ea91d0285#term-tag), [wrapper](#term-wrapper).
Related publication
[Gudeman (1993)](/u/80406cde1a6844cf#gudeman93).wrapper : A wrapper is that part of a wrapped representation that is copied when the value is passed by value.
The wrapper does not include parts of the representation that
are accessed indirectly, and are not copied when the value is
passed.
For instance, a [Lisp](/u/884599c4278a5039#term-lisp) implementation might use the top
two bits of a value representation as a [tag](/u/f992775ea91d0285#term-tag) to
distinguish between integers and [cons (1)](/u/b107b7d39b75ccb0#term-cons-1) cells,
setting these bits to 01 for a [pointer](/u/5195e3271b5de55e#term-pointer) to a cons cell
and 11 for an integer. Then the wrapped value of the number 4
would have binary representation 11000…00100, and the
wrapper for this number is the whole of this wrapped value.
The pointer to a cons cell stored at location 4 would have
binary representation 01000…00100. The wrapped value of the
cons cell is the combination of this pointer and the cons cell
in memory itself. The wrapper of the cons cell is just the
pointer; when the cons cell is passed as a function argument,
just the pointer is passed.
See also
[boxed](/u/4c6aaf4e0e0b7eb6#term-boxed), [wrapped](#term-wrapped).
Related publication
[Gudeman (1993)](/u/80406cde1a6844cf#gudeman93).write barrier : A write barrier (1) is a block on writing to certain memory (2) locations by certain threads or processes.
Relevance to memory management
Write barriers are used for [incremental](/u/7010622dc3b8d8f9#term-incremental-garbage-collection) or [concurrent](/u/5195e3271b5de55e#term-parallel-garbage-collection) [garbage collection](/u/9334865be20dfda3#term-garbage-collection).
They are also used to maintain [remembered sets](/u/611c5a77bde93a2f#term-remembered-set) for
[generational](/u/9334865be20dfda3#term-generational-garbage-collection)
[collectors (1)](/u/9334865be20dfda3#term-garbage-collector).
See also
[read barrier](/u/611c5a77bde93a2f#term-read-barrier).write fault : An exception which occurs when writing to an address in virtual memory.
This is probably either a [page fault](/u/5195e3271b5de55e#term-page-fault), an
[invalid page fault](/u/7010622dc3b8d8f9#term-invalid-page-fault) or a [protection fault](/u/5195e3271b5de55e#term-protection-fault).
Similar term
[segmentation violation](/u/699ff3e2d070663d#term-segmentation-violation).
See also
[read fault](/u/611c5a77bde93a2f#term-read-fault).