Arduino DLNA Server
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | List of all members
tiny_dlna::AllocatorPSRAM< T > Class Template Reference

Custom allocator that uses ESP32's PSRAM for memory allocation. More...

#include <Allocator.h>

Classes

struct  rebind
 Rebind allocator to another type. More...
 

Public Types

using value_type = T
 
using pointer = T *
 
using const_pointer = const T *
 
using reference = T &
 
using const_reference = const T &
 
using size_type = std::size_t
 
using difference_type = std::ptrdiff_t
 
using is_always_equal = std::true_type
 
using propagate_on_container_move_assignment = std::true_type
 

Public Member Functions

 AllocatorPSRAM () noexcept
 Default constructor.
 
template<typename U >
 AllocatorPSRAM (const AllocatorPSRAM< U > &) noexcept
 Copy constructor from another allocator type.
 
pointer allocate (size_type n)
 Allocate memory from PSRAM.
 
void deallocate (pointer p, size_type) noexcept
 Deallocate memory.
 
template<typename U >
bool operator== (const AllocatorPSRAM< U > &) const noexcept
 
template<typename U >
bool operator!= (const AllocatorPSRAM< U > &) const noexcept
 

Detailed Description

template<typename T>
class tiny_dlna::AllocatorPSRAM< T >

Custom allocator that uses ESP32's PSRAM for memory allocation.

Template Parameters
TType of elements to allocate

This allocator uses ESP32's heap_caps_malloc with MALLOC_CAP_SPIRAM flag to ensure all memory is allocated in PSRAM instead of regular RAM.

Member Typedef Documentation

◆ const_pointer

template<typename T >
using tiny_dlna::AllocatorPSRAM< T >::const_pointer = const T*

◆ const_reference

template<typename T >
using tiny_dlna::AllocatorPSRAM< T >::const_reference = const T&

◆ difference_type

template<typename T >
using tiny_dlna::AllocatorPSRAM< T >::difference_type = std::ptrdiff_t

◆ is_always_equal

template<typename T >
using tiny_dlna::AllocatorPSRAM< T >::is_always_equal = std::true_type

◆ pointer

template<typename T >
using tiny_dlna::AllocatorPSRAM< T >::pointer = T*

◆ propagate_on_container_move_assignment

template<typename T >
using tiny_dlna::AllocatorPSRAM< T >::propagate_on_container_move_assignment = std::true_type

◆ reference

template<typename T >
using tiny_dlna::AllocatorPSRAM< T >::reference = T&

◆ size_type

template<typename T >
using tiny_dlna::AllocatorPSRAM< T >::size_type = std::size_t

◆ value_type

template<typename T >
using tiny_dlna::AllocatorPSRAM< T >::value_type = T

Constructor & Destructor Documentation

◆ AllocatorPSRAM() [1/2]

template<typename T >
tiny_dlna::AllocatorPSRAM< T >::AllocatorPSRAM ( )
inlinenoexcept

Default constructor.

◆ AllocatorPSRAM() [2/2]

template<typename T >
template<typename U >
tiny_dlna::AllocatorPSRAM< T >::AllocatorPSRAM ( const AllocatorPSRAM< U > &  )
inlinenoexcept

Copy constructor from another allocator type.

Template Parameters
UType of the other allocator
Parameters
otherThe other allocator

Member Function Documentation

◆ allocate()

template<typename T >
pointer tiny_dlna::AllocatorPSRAM< T >::allocate ( size_type  n)
inline

Allocate memory from PSRAM.

Parameters
nNumber of elements to allocate
Returns
Pointer to allocated memory
Exceptions
std::bad_allocIf allocation fails or size is too large

◆ deallocate()

template<typename T >
void tiny_dlna::AllocatorPSRAM< T >::deallocate ( pointer  p,
size_type   
)
inlinenoexcept

Deallocate memory.

Parameters
pPointer to memory to deallocate
sizeSize of allocation (unused)

◆ operator!=()

template<typename T >
template<typename U >
bool tiny_dlna::AllocatorPSRAM< T >::operator!= ( const AllocatorPSRAM< U > &  ) const
inlinenoexcept

◆ operator==()

template<typename T >
template<typename U >
bool tiny_dlna::AllocatorPSRAM< T >::operator== ( const AllocatorPSRAM< U > &  ) const
inlinenoexcept

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