Re: [PATCH] rust: slab: add basic slab module

Danilo Krummrich
2025-09-28T14:47:47Z

On Thu Sep 25, 2025 at 11:54 AM CEST, Danilo Krummrich wrote:
> (3) Implement a macro to generate a custom KmemCache Allocator trait
> implementation for every KmemCache instance with a static lifetime.

Thinking about it a bit more, I think we should go with option (3) for now.

With its only limitation being that it always binds the lifetime of a kmemcache
to the module lifetime, it still seems to be the best option, considering that
the alternatives require additional synchronization in hot paths, may *silently*
leak the kmemcache, cause significant code duplication or break dynamic
dispatch.

Tieing the kmemcache to the module lifetime should cover the vast majority of
use-cases; should we ever really need something else we can still revisit the
options.

Thanks,
Danilo