FastLED 3.9.15
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 344 of file allocator.h.

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