From Jason Turner

[mem.res.pool.mem]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpldp48lhv/{from.md → to.md} +73 -0
tmp/tmpldp48lhv/{from.md → to.md} RENAMED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Pool resource members <a id="mem.res.pool.mem">[[mem.res.pool.mem]]</a>
2
+
3
+ ``` cpp
4
+ void release();
5
+ ```
6
+
7
+ *Effects:* Calls `upstream_resource()->deallocate()` as necessary to
8
+ release all allocated memory.
9
+
10
+ [*Note 1*: The memory is released back to `upstream_resource()` even if
11
+ `deallocate` has not been called for some of the allocated
12
+ blocks. — *end note*]
13
+
14
+ ``` cpp
15
+ memory_resource* upstream_resource() const;
16
+ ```
17
+
18
+ *Returns:* The value of the `upstream` argument provided to the
19
+ constructor of this object.
20
+
21
+ ``` cpp
22
+ pool_options options() const;
23
+ ```
24
+
25
+ *Returns:* The options that control the pooling behavior of this
26
+ resource. The values in the returned struct may differ from those
27
+ supplied to the pool resource constructor in that values of zero will be
28
+ replaced with *implementation-defined* defaults, and sizes may be
29
+ rounded to unspecified granularity.
30
+
31
+ ``` cpp
32
+ void* do_allocate(size_t bytes, size_t alignment) override;
33
+ ```
34
+
35
+ *Returns:* A pointer to allocated storage
36
+ ([[basic.stc.dynamic.deallocation]]) with a size of at least `bytes`.
37
+ The size and alignment of the allocated memory shall meet the
38
+ requirements for a class derived from `memory_resource` ([[mem.res]]).
39
+
40
+ *Effects:* If the pool selected for a block of size `bytes` is unable to
41
+ satisfy the memory request from its own internal data structures, it
42
+ will call `upstream_resource()->allocate()` to obtain more memory. If
43
+ `bytes` is larger than that which the largest pool can handle, then
44
+ memory will be allocated using `upstream_resource()->allocate()`.
45
+
46
+ *Throws:* Nothing unless `upstream_resource()->allocate()` throws.
47
+
48
+ ``` cpp
49
+ void do_deallocate(void* p, size_t bytes, size_t alignment) override;
50
+ ```
51
+
52
+ *Effects:* Returns the memory at `p` to the pool. It is unspecified if,
53
+ or under what circumstances, this operation will result in a call to
54
+ `upstream_resource()->deallocate()`.
55
+
56
+ *Throws:* Nothing.
57
+
58
+ ``` cpp
59
+ bool synchronized_pool_resource::do_is_equal(
60
+ const memory_resource& other) const noexcept override;
61
+ ```
62
+
63
+ *Returns:*
64
+ `this == dynamic_cast<const synchronized_pool_resource*>(&other)`.
65
+
66
+ ``` cpp
67
+ bool unsynchronized_pool_resource::do_is_equal(
68
+ const memory_resource& other) const noexcept override;
69
+ ```
70
+
71
+ *Returns:*
72
+ `this == dynamic_cast<const unsynchronized_pool_resource*>(&other)`.
73
+