[mem.res.pool.ctor]

# 20 Memory management library [[mem]](./#mem)

## 20.5 Memory resources [[mem.res]](mem.res#pool.ctor)

### 20.5.5 Pool resource classes [[mem.res.pool]](mem.res.pool#ctor)

#### 20.5.5.3 Constructors and destructors [mem.res.pool.ctor]

[ð](#lib:synchronized_pool_resource,constructor)

`synchronized_pool_resource(const pool_options& opts, memory_resource* upstream);
unsynchronized_pool_resource(const pool_options& opts, memory_resource* upstream);
`

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/memory.tex#L8246)

*Preconditions*: upstream is the address of a valid memory resource[.](#1.sentence-1)

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/memory.tex#L8250)

*Effects*: Constructs a pool resource object that will obtain memory from upstream whenever the pool resource is unable to satisfy a memory request
from its own internal data structures[.](#2.sentence-1)

The resulting object will hold a copy of upstream,
but will not own the resource to which upstream points[.](#2.sentence-2)

[*Note [1](#note-1)*:

The intention is that calls to upstream->allocate() will be substantially fewer than calls to this->allocate() in most cases[.](#2.sentence-3)

â *end note*]

The behavior of the pooling mechanism is tuned
according to the value of the opts argument[.](#2.sentence-4)

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/memory.tex#L8265)

*Throws*: Nothing unless upstream->allocate() throws[.](#3.sentence-1)

It is unspecified if, or under what conditions,
this constructor calls upstream->allocate()[.](#3.sentence-2)

[ð](#lib:synchronized_pool_resource,destructor)

`virtual ~synchronized_pool_resource();
virtual ~unsynchronized_pool_resource();
`

[4](#4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/memory.tex#L8280)

*Effects*: Calls release()[.](#4.sentence-1)
