MCPcopy Create free account
hub / github.com/FastLED/FastLED / allocate

Function allocate

src/fl/stl/allocator.h:306–317  ·  view source on GitHub ↗

Standard allocate() - allocates new memory

Source from the content-addressed store, hash-verified

304
305 // Standard allocate() - allocates new memory
306 T* allocate(fl::size n) FL_NOEXCEPT {
307 if (n == 0) {
308 return nullptr;
309 }
310 fl::size size = sizeof(T) * n;
311 void *ptr = Malloc(size);
312 if (ptr == nullptr) {
313 return nullptr;
314 }
315 fl::memset(ptr, 0, sizeof(T) * n);
316 return static_cast<T*>(ptr);
317 }
318
319 // Standard deallocate()
320 void deallocate(T* p, fl::size n) FL_NOEXCEPT {

Callers 4

allocate_at_leastMethod · 0.70
allocate_at_leastFunction · 0.70
allocate_at_leastMethod · 0.70
reallocateMethod · 0.70

Calls 2

MallocFunction · 0.85
memsetFunction · 0.85

Tested by

no test coverage detected