@@ -11824,30 +11824,54 @@
11824
11824
are general-purpose memory resources having the following qualities:
11825
11825
\begin{itemize}
11826
11826
\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
+
11829
11854
\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}.
11835
11855
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
+
11837
11859
\item
11838
11860
When a particular pool is exhausted,
11839
11861
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.
11842
11864
With each successive replenishment,
11843
11865
the chunk size obtained increases geometrically.
11844
11866
\begin{note}
11845
11867
By allocating memory in chunks,
11846
11868
the pooling strategy increases the chance that consecutive allocations
11847
11869
will be close together in memory.\end{note}
11870
+
11848
11871
\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
+
11851
11875
\item
11852
11876
A \tcode{pool_options} struct may be passed to the pool resource constructors
11853
11877
to tune the largest block size and the maximum chunk size.
11943
11967
\begin{itemdescr}
11944
11968
\pnum
11945
11969
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 }
11947
11971
to replenish a pool.
11948
11972
If the value of \tcode{max_blocks_per_chunk} is zero or
11949
11973
is greater than an \impldef{largest supported value to configure the maximum number of blocks to replenish a pool}
0 commit comments