22. MVFF pool class¶
22.1. Introduction¶
.intro: This is the design of the MVFF (Manual Variable First-Fit) pool class. This pool implements a first (or last) fit policy for variable-sized manually-managed objects, with control over first/last, segment preference high/low, and slot fit low/high.
.background: The pool was created in a response to a belief that the ScriptWorks EPDL/EPDR’s first fit policy is beneficial for some classes of client behaviour, but the performance of a linear free list was unacceptable.
22.2. Overview¶
.over: This pool implements certain variants of the address-ordered first-fit policy. The implementation allows allocation across segment boundaries.
.over.buffer: Buffered allocation is also supported, but in that case, the buffer-filling policy is worst-fit. Buffered and unbuffered allocation can be used at the same time, but in that case, the first ap must be created before any allocations.
.over.buffer.class: The pool uses the simplest buffer class,
BufferClass
. This is appropriate since these buffers don’t attach
to segments, and hence don’t constrain buffered regions to lie within
segment boundaries.
22.3. Methods¶
.method.buffer: The buffer methods implement a worst-fit fill strategy.
22.4. Implementation¶
.impl.alloc_list: The pool stores the address ranges that it has acquired from the arena in a CBS (see design.mps.cbs).
.impl.free-list: The pool stores its free list in a CBS (see design.mps.cbs), failing over in emergencies to a Freelist (see design.mps.freelist) when the CBS cannot allocate new control structures. This is the reason for the alignment restriction above.
22.5. Details¶
.design.acquire-size: When acquiring memory from the arena, we use
extendBy
as the unit of allocation unless the object won’t fit, in
which case we use the object size (in both cases we align up to the
arena alignment).
.design.acquire-fail: If allocating extendBy
, we try again with
an aligned size just large enough for the object we’re allocating.
This is in response to request.mps.170186.