[mem.res.monotonic.buffer.ctor]

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

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

### 20.5.6 Class monotonic_buffer_resource [[mem.res.monotonic.buffer]](mem.res.monotonic.buffer#ctor)

#### 20.5.6.2 Constructors and destructor [mem.res.monotonic.buffer.ctor]

[ð](#lib:monotonic_buffer_resource,constructor)

`explicit monotonic_buffer_resource(memory_resource* upstream);
monotonic_buffer_resource(size_t initial_size, memory_resource* upstream);
`

[1](#1)

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

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

initial_size, if specified, is greater than zero[.](#1.sentence-2)

[2](#2)

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

*Effects*: Sets upstream_rsrc to upstream andcurrent_buffer to nullptr[.](#2.sentence-1)

If initial_size is specified,
sets next_buffer_size to at least initial_size;
otherwise sets next_buffer_size to animplementation-defined size[.](#2.sentence-2)

[ð](#lib:monotonic_buffer_resource,constructor_)

`monotonic_buffer_resource(void* buffer, size_t buffer_size, memory_resource* upstream);
`

[3](#3)

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

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

buffer_size is no larger than the number of bytes in buffer[.](#3.sentence-2)

[4](#4)

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

*Effects*: Sets upstream_rsrc to upstream,current_buffer to buffer, andnext_buffer_size to buffer_size (but not less than 1),
then increases next_buffer_size by an implementation-defined growth factor (which need not be integral)[.](#4.sentence-1)

[ð](#lib:monotonic_buffer_resource,destructor)

`~monotonic_buffer_resource();
`

[5](#5)

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

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