Expand description
Talc allocator integration.
TalcAlloc is a type alias for &'static CacheTalcLock. Talc’s
Talck already implements allocator_api2::alloc::Allocator, and
&'static T inherits that impl. The whole “allocator handle” is
just a borrow — Copy + Clone + Send + Sync for free.
Construction is one line at the call site:
- Tests:
&TALCwherestatic TALC: CacheTalcLock = new_cache_talc_lock();(see thetest_arenahelper). - Production: the talc lives at a fixed VA (mmap’d, pinned for
the process lifetime):
ⓘThe single
let alloc: TalcAlloc = unsafe { &*(STATE_CACHE_VA as *const CacheTalcLock) };unsafe { &*VA }cast asserts the'staticlifetime that the mmap pinning guarantees.
Structs§
- Claim
OnOom - An out-of-memory handler that attempts to claim the
memory within the given
Spanupon OOM. - ErrOn
Oom - Doesn’t handle out-of-memory conditions, immediate allocation error occurs.
- Mutex
- A mutual exclusion primitive useful for protecting shared data
- Mutex
Guard - An RAII implementation of a “scoped lock” of a mutex. When this structure is dropped (falls out of scope), the lock will be unlocked.
- RawSpinlock
- Provides mutual exclusion based on spinning on an
AtomicBool. - Span
- Represents an interval of memory
[base, acme) - Talc
- The Talc Allocator!
- Talck
- Talc lock, contains a mutex-locked
Talc.
Traits§
Functions§
- new_
cache_ talc_ lock - Const constructor for a fresh empty
CacheTalcLock. Suitable for astaticbinding; backing memory must be supplied at runtime vialock.lock().claim(Span::from_array(...)).
Type Aliases§
- Cache
Talc Lock - Concrete
Talckflavour used by the shared state-cache region. - Talc
Alloc - Workspace allocator handle. Just a
'staticborrow of aCacheTalcLock—Copy + Clone + Send + Syncby reference, and the underlyingTalckalready implsallocator_api2::alloc::Allocator.