FastLED 3.9.15
Loading...
Searching...
No Matches

◆ allocate()

template<typename T>
T * fl::allocator< T >::allocate ( fl::size n)
inline

Definition at line 88 of file allocator.h.

88 {
89 if (n == 0) {
90 return nullptr; // Handle zero allocation
91 }
92 fl::size size = sizeof(T) * n;
93 void *ptr = Malloc(size);
94 if (ptr == nullptr) {
95 return nullptr; // Handle allocation failure
96 }
97 fl::memfill(ptr, 0, sizeof(T) * n); // Zero-initialize the memory
98 return static_cast<T*>(ptr);
99 }
void * memfill(void *ptr, int value, fl::size num)
Definition memfill.h:11
void * Malloc(fl::size size)

Referenced by fl::allocator_slab< T, SLAB_SIZE >::allocate().

+ Here is the caller graph for this function: