|
ESP32 PSRAM Library
|
Custom allocator that uses ESP32's PSRAM for memory allocation. More...
#include <AllocatorPSRAM.h>
Classes | |
| struct | rebind |
| Rebind allocator to another type. More... | |
Public Member Functions | |
| AllocatorPSRAM () noexcept | |
| Default constructor. | |
| template<typename U > | |
| AllocatorPSRAM (const AllocatorPSRAM< U > &) noexcept | |
| Copy constructor from another allocator type. More... | |
| pointer | allocate (size_type n) |
| Allocate memory from PSRAM. More... | |
| void | deallocate (pointer p, size_type) noexcept |
| Deallocate memory. More... | |
Custom allocator that uses ESP32's PSRAM for memory allocation.
| T | Type 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. If PSRAM allocation fails, it falls back to regular RAM.
|
inlinenoexcept |
Copy constructor from another allocator type.
| U | Type of the other allocator |
| other | The other allocator |
|
inline |
Allocate memory from PSRAM.
| n | Number of elements to allocate |
| std::bad_alloc | If allocation fails or size is too large |
|
inlinenoexcept |
Deallocate memory.
| p | Pointer to memory to deallocate |
| size | Size of allocation (unused) |