FastLED 3.10.6
Loading...
Searching...
No Matches

◆ allocate_at_least()

template<typename T>
allocation_result< pointer, size_type > fl::allocator_realloc< T >::allocate_at_least ( fl::size n)
inline

Definition at line 345 of file allocator.h.

345 {
346 if (n == 0) {
347 return {nullptr, 0};
348 }
349 // Ask for 1.5x to reduce future reallocations
350 fl::size requested = (3 * n) / 2;
352 if (ptr) {
353 return {ptr, requested};
354 }
355 // Fallback: try exact size if 1.5x failed
356 ptr = allocate(n);
357 return {ptr, ptr ? n : 0};
358 }
T * allocate(fl::size n) FL_NO_EXCEPT
Definition allocator.h:307