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§
- RtSection
- No-op real-time section guard. With
rt-paranoidoff this is a zero-sized type whoseenter/drop compile away.
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. - is_
active - The checker is not compiled in.
- set_
mode - No-op with
rt-paranoidoff.