84 template<
typename... Args>
91 new (
ptr) T(std::forward<Args>(
args)...);
92 return static_cast<T *
>(
ptr);
basic_string_view< char > string_view
static consteval string_view getTypeName()
#define pr_emerg(fmt,...)
void slab_init()
initialise the slab allocator
void * slab_realloc(void *addr, size_t size)
Reallocate a block of memory from the slab allocator.
void slab_register(slab_t *slab)
void * slab_alloc(size_t size)
Allocate a block of memory from the slab allocator.
void kmemcache_free(slab_t *slab, const void *addr)
void slab_free(const void *addr)
Free a block of memory from the slab allocator.
void * kmemcache_alloc(slab_t *slab)
void * slab_calloc(size_t nmemb, size_t size)
Allocate a block of memory from the slab allocator and zero it.
T * create(Args &&...args)
constexpr Slab(mos::string_view name=T::type_name, size_t size=sizeof(T), mos::string_view type_name=mos::getTypeName< T >())
mos::string_view type_name