ZXFoundation™ 26h2
Loading...
Searching...
No Matches
zxfoundation.memory.slub.typed Module Reference

Data Structures

class  zxfoundation::memory::slub::slab_ptr< T >
 Move-only RAII owner of a slab-allocated T. More...
class  zxfoundation::memory::slub::typed_slab_cache< T >
 Type-safe handle to a kmem_cache. More...

Functions

auto alloc () noexcept -> std::expected< T *, lib::kernel_error >
 Allocate one uninitialized object of type T.
static auto create (const char *name, slub_flags flags=slub_flags::none) noexcept -> std::expected< typed_slab_cache< T >, lib::kernel_error >
 Create a new kmem_cache sized for T and return a typed handle.
auto dealloc (T *obj) noexcept -> void
 Free a raw T* back to the slab.
auto get () const noexcept -> T *
template<typename... Args>
auto make (Args &&... args) noexcept -> std::expected< slab_ptr< T >, lib::kernel_error >
 Construct a T in a fresh slab slot and wrap it in slab_ptr.
 operator bool () const noexcept
 operator bool () const noexcept
auto operator* () const noexcept -> T &
auto operator-> () const noexcept -> T *
auto operator= (const slab_ptr &) noexcept=delete
auto operator= (slab_ptr &&o) noexcept -> slab_ptr &
auto operator= (const typed_slab_cache &) noexcept -> typed_slab_cache &=default
auto raw () const noexcept -> kmem_cache *
 Underlying type-erased cache (for interop with C-style APIs).
auto release () noexcept -> T *
 Release ownership without destroying the object.
auto reset () noexcept -> void
 Destroy the object and free the slab slot immediately.
 slab_ptr (const slab_ptr &)=delete
 slab_ptr (slab_ptr &&o) noexcept
 slab_ptr (T *obj, kmem_cache *cache) noexcept
 Adopt an existing slab-allocated T.
 typed_slab_cache (const typed_slab_cache &) noexcept=default
 typed_slab_cache (kmem_cache_ref_active c) noexcept
 Wrap an existing (already-initialized) kmem_cache.
auto valid () const noexcept -> bool

Files

file  zxfoundation/memory/slub.zcomponent/typed.cxxm