Expand description
Paranoid real-time allocation checking (the rt-paranoid feature).
A wrapping global allocator (RtCheckAlloc) plus a thread-local
“audio section” guard (RtSection). While the audio thread is
inside a section, any allocation it makes is a real-time contract
violation and gets recorded and reported.
The section is entered around the single plugin.process() call in
chunked_process, which every format wrapper and the test driver
route through, so one guard covers all of them. The allocator is
installed by the artifact (a plugin cdylib via truce::plugin!, or a
test binary) with truce::enable_rt_paranoid!; a library cannot set
a downstream binary’s global allocator.
Everything here is inert unless the rt-paranoid feature is on:
RtSection::enter is a zero-sized no-op and allow_alloc just
calls the closure, so release builds are unaffected.
Structs§
- Mutex
- A
std::sync::Mutexthat, withrt-paranoidon, flags a lock taken on the audio thread inside aprocesssection. A plugin that wants lock checking uses this in place of the std type; with the feature off it is a zero-cost newtype that just delegates. - RtSection
- No-op real-time section guard. With
rt-paranoidoff this is a zero-sized type whoseenter/drop compile away. - RwLock
- A
std::sync::RwLockthat, withrt-paranoidon, flags areadorwritetaken on the audio thread inside aprocesssection. Same coverage caveat asMutex.
Enums§
- Mode
- What the checker does on a violation. Present with the feature off
so
set_modecall sites compile unconditionally; the checker is inert, so it has no effect.
Functions§
- allow_
alloc - No-op with
rt-paranoidoff: just callsf. - audit
- No-op with
rt-paranoidoff: runsf, reports zero allocations. - check_
dealloc - Always
falsewithrt-paranoidoff. - is_
active - The checker is not compiled in.
- set_
check_ dealloc - No-op with
rt-paranoidoff. - set_
mode - No-op with
rt-paranoidoff.