|
ESPHome 2026.9.0
|
An STL allocator that uses SPI or internal RAM. More...
#include <helpers.h>
Public Types | |
| enum | Flags { NONE = 0 , ALLOC_EXTERNAL = 1 << 0 , ALLOC_INTERNAL = 1 << 1 , ALLOW_FAILURE = 1 << 2 , PREFER_INTERNAL = 1 << 3 } |
| using | value_type = T |
Public Member Functions | |
| constexpr | RAMAllocator ()=default |
| constexpr | RAMAllocator (uint8_t flags) |
| template<class U > | |
| constexpr | RAMAllocator (const RAMAllocator< U > &other) |
| T * | allocate (size_t n) |
| T * | allocate (size_t n, size_t manual_size) |
| T * | reallocate (T *p, size_t n) |
| T * | reallocate (T *p, size_t n, size_t manual_size) |
| void | deallocate (T *p, size_t n) |
| template<typename... Args> | |
| RAMUniquePtr< T > | make_unique (Args &&...args) |
| Value initialize one T; empty on exhaustion. | |
| RAMUniquePtr< T[]> | make_unique_array_for_overwrite (size_t n) |
| n elements left uninitialized, as std::make_unique_for_overwrite does; empty on exhaustion, overflow, and n == 0 | |
| size_t | get_free_heap_size () const |
| Return the total heap space available via this allocator. | |
| size_t | get_max_free_block_size () const |
| Return the maximum size block this allocator could allocate. | |
An STL allocator that uses SPI or internal RAM.
Returns nullptr in case no memory is available.
By setting flags, it can be configured to:
| using esphome::RAMAllocator< T >::value_type = T |
| enum esphome::RAMAllocator::Flags |
|
constexprdefault |
|
inlineconstexpr |
|
inlineconstexpr |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |