Skip to content

Commit 9d729ef

Browse files
committed
[mem.res.pool.overview] add proper definitions of terms
Update cross-reference in [mem.res.pool.options] to refer to [mem.res.pool.overview]. Fixes #1258
1 parent d4a20b6 commit 9d729ef

File tree

1 file changed

+37
-13
lines changed

1 file changed

+37
-13
lines changed

source/utilities.tex

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11824,30 +11824,54 @@
1182411824
are general-purpose memory resources having the following qualities:
1182511825
\begin{itemize}
1182611826
\item
11827-
Each resource frees its allocated memory on destruction,
11828-
even if \tcode{deallocate} has not been called for some of the allocated blocks.
11827+
A pool resource has an \defn{upstream memory resource},
11828+
supplied on construction, which is used to allocate memory that
11829+
the pool resource subdivides to satisfy calls to its own
11830+
\tcode{do_allocate} member.
11831+
11832+
\item
11833+
A \defn{chunk} is a region of storage allocated
11834+
from the upstream memory resource. A pool resource divides
11835+
each chunk into one or more blocks of the same block size.
11836+
Different chunks can have different block sizes, and different
11837+
numbers of blocks.
11838+
11839+
\item
11840+
A \defn{pool} is a collection of chunks that all have the same
11841+
block size. Each pool resource contains a collection of pools
11842+
with different block sizes.
11843+
11844+
\item
11845+
On destruction, a pool resource frees all the memory it obtained from
11846+
its upstream memory resource by calling the upstream resource's
11847+
\tcode{deallocate} function.
11848+
\begin{note}
11849+
This frees all memory returned by the pool resource's \tcode{do_allocate}
11850+
function, even if \tcode{do_deallocate} has not been called for some
11851+
of the allocated blocks.
11852+
\end{note}
11853+
1182911854
\item
11830-
A pool resource consists of a collection of \defn{pools},
11831-
serving requests for different block sizes.
11832-
Each individual pool manages a collection of \defn{chunks}
11833-
that are in turn divided into blocks of uniform size,
11834-
returned via calls to \tcode{do_allocate}.
1183511855
Each call to \tcode{do_allocate(size, alignment)} is dispatched
11836-
to the pool serving the smallest blocks accommodating at least \tcode{size} bytes.
11856+
to the pool serving the smallest blocks that accommodate
11857+
\tcode{size} and \tcode{alignment}.
11858+
1183711859
\item
1183811860
When a particular pool is exhausted,
1183911861
allocating a block from that pool results in the allocation
11840-
of an additional chunk of memory from the \defn{upstream allocator}
11841-
(supplied at construction), thus replenishing the pool.
11862+
of an additional chunk from the upstream memory resource,
11863+
thus replenishing the pool.
1184211864
With each successive replenishment,
1184311865
the chunk size obtained increases geometrically.
1184411866
\begin{note}
1184511867
By allocating memory in chunks,
1184611868
the pooling strategy increases the chance that consecutive allocations
1184711869
will be close together in memory.\end{note}
11870+
1184811871
\item
11849-
Allocation requests that exceed the largest block size of any pool
11850-
are fulfilled directly from the upstream allocator.
11872+
Allocation requests that exceed the largest block size and/or alignment
11873+
of any pool are fulfilled directly from the upstream allocator.
11874+
1185111875
\item
1185211876
A \tcode{pool_options} struct may be passed to the pool resource constructors
1185311877
to tune the largest block size and the maximum chunk size.
@@ -11943,7 +11967,7 @@
1194311967
\begin{itemdescr}
1194411968
\pnum
1194511969
The maximum number of blocks that will be allocated at once
11946-
from the upstream memory resource\iref{mem.res.monotonic.buffer}
11970+
from the upstream memory resource\iref{mem.res.pool.overview}
1194711971
to replenish a pool.
1194811972
If the value of \tcode{max_blocks_per_chunk} is zero or
1194911973
is greater than an \impldef{largest supported value to configure the maximum number of blocks to replenish a pool}

0 commit comments

Comments
 (0)