ESPHome  2024.7.0
Public Types | Public Member Functions
esphome::ExternalRAMAllocator< T > Class Template Reference

An STL allocator that uses SPI RAM. More...

#include <helpers.h>

Public Types

enum  Flags { NONE = 0, REFUSE_INTERNAL = 1 << 0, ALLOW_FAILURE = 1 << 1 }
using value_type = T

Public Member Functions

 ExternalRAMAllocator ()=default
 ExternalRAMAllocator (Flags flags)
template<class U >
constexpr ExternalRAMAllocator (const ExternalRAMAllocator< U > &other)
T * allocate (size_t n)
void deallocate (T *p, size_t n)

Detailed Description

template<class T>
class esphome::ExternalRAMAllocator< T >

An STL allocator that uses SPI RAM.

By setting flags, it can be configured to don't try main memory if SPI RAM is full or unavailable, and to return nulllptr instead of aborting when no memory is available.

Definition at line 651 of file helpers.h.

Member Typedef Documentation

◆ value_type

template<class T>
using esphome::ExternalRAMAllocator< T >::value_type = T

Definition at line 653 of file helpers.h.

Member Enumeration Documentation

◆ Flags

template<class T>
enum esphome::ExternalRAMAllocator::Flags

Refuse falling back to internal memory when external RAM is full or unavailable.


Don't abort when memory allocation fails.

Definition at line 655 of file helpers.h.

Constructor & Destructor Documentation

◆ ExternalRAMAllocator() [1/3]

template<class T>
esphome::ExternalRAMAllocator< T >::ExternalRAMAllocator ( )

◆ ExternalRAMAllocator() [2/3]

template<class T>
esphome::ExternalRAMAllocator< T >::ExternalRAMAllocator ( Flags  flags)

Definition at line 662 of file helpers.h.

◆ ExternalRAMAllocator() [3/3]

template<class T>
template<class U >
constexpr esphome::ExternalRAMAllocator< T >::ExternalRAMAllocator ( const ExternalRAMAllocator< U > &  other)

Definition at line 663 of file helpers.h.

Member Function Documentation

◆ allocate()

template<class T>
T* esphome::ExternalRAMAllocator< T >::allocate ( size_t  n)

Definition at line 665 of file helpers.h.

◆ deallocate()

template<class T>
void esphome::ExternalRAMAllocator< T >::deallocate ( T *  p,
size_t  n 

Definition at line 678 of file helpers.h.

The documentation for this class was generated from the following file: