| 619 | } |
| 620 | |
| 621 | T* allocate(fl::size n = 1) FL_NOEXCEPT { |
| 622 | if (n == 0) { |
| 623 | return nullptr; |
| 624 | } |
| 625 | |
| 626 | // Try to allocate from slab first |
| 627 | void* ptr = allocateFromSlab(n); |
| 628 | if (ptr) { |
| 629 | fl::memset(ptr, 0, sizeof(T) * n); |
| 630 | return static_cast<T*>(ptr); |
| 631 | } |
| 632 | |
| 633 | // Fall back to regular malloc for large allocations |
| 634 | ptr = Malloc(sizeof(T) * n); |
| 635 | if (ptr) { |
| 636 | fl::memset(ptr, 0, sizeof(T) * n); |
| 637 | } |
| 638 | return static_cast<T*>(ptr); |
| 639 | } |
| 640 | |
| 641 | void deallocate(T* ptr, fl::size n = 1) FL_NOEXCEPT { |
| 642 | if (!ptr) { |