Table of Contents

C++ Dynamic memory management

https://en.cppreference.com/w/cpp/memory

Smart pointers

Smart pointers enable automatic, exception-safe, object lifetime management.

Allocators

Allocators are class templates encapsulating memory allocation strategy. This allows generic containers to decouple memory management from the data itself.

Memory resources

Memory resources implement memory allocation strategies that can be used by

Uninitialized storage

Several utilities are provided to create and access raw storage.

Uninitialized memory algorithms

Constrained uninitialized memory algorithms {{mark c++20}}

C++20 provides cpp/language/constraints | constrained uninitialized memory algorithms that accept range arguments or iterator-sentinel pairs.

]] | specifies some operation on iterators, sentinels and ranges are non-throwing}} {{dsc inc | cpp/memory/ranges/dsc uninitialized_copy}} {{dsc inc | cpp/memory/ranges/dsc uninitialized_copy_n}} {{dsc inc | cpp/memory/ranges/dsc uninitialized_fill}} {{dsc inc | cpp/memory/ranges/dsc uninitialized_fill_n}} {{dsc inc | cpp/memory/ranges/dsc uninitialized_move}} {{dsc inc | cpp/memory/ranges/dsc uninitialized_move_n}} {{dsc inc | cpp/memory/ranges/dsc uninitialized_default_construct}} {{dsc inc | cpp/memory/ranges/dsc uninitialized_default_construct_n}} {{dsc inc | cpp/memory/ranges/dsc uninitialized_value_construct}} {{dsc inc | cpp/memory/ranges/dsc uninitialized_value_construct_n}} {{dsc inc | cpp/memory/ranges/dsc destroy_at}} {{dsc inc | cpp/memory/ranges/dsc destroy}} {{dsc inc | cpp/memory/ranges/dsc destroy_n}} {{dsc inc | cpp/memory/ranges/dsc construct_at}} {{dsc end}} ===Garbage collector support=== {{dsc begin}} {{dsc header | memory}} {{dsc inc | cpp/memory/gc/dsc declare_reachable}} {{dsc inc | cpp/memory/gc/dsc undeclare_reachable}} {{dsc inc | cpp/memory/gc/dsc declare_no_pointers}} {{dsc inc | cpp/memory/gc/dsc undeclare_no_pointers}} {{dsc inc | cpp/memory/gc/dsc pointer_safety}} {{dsc inc | cpp/memory/gc/dsc get_pointer_safety}} {{dsc end}} ===Miscellaneous=== {{dsc begin}} {{dsc header | memory}} {{dsc inc | cpp/memory/dsc pointer_traits}} {{dsc inc | cpp/memory/dsc to_address}} {{dsc inc | cpp/memory/dsc addressof}} {{dsc inc | cpp/memory/dsc align}} {{dsc inc | cpp/memory/dsc assume_aligned}} {{dsc end}} ===[[cpp/memory/c | C-style memory management

Includes e.g.

,

[[cpp/memory/new ]] | [[ Low level memory management]]

Includes e.g.

,

,