pub fn with_kdf_memory_permit<T>(cost_kib: u32, f: impl FnOnce() -> T) -> TExpand description
Runs f (a key derivation) while holding a reservation of cost_kib
against the global memory budget, blocking until enough budget is free.
A cost larger than the whole budget is clamped to it, so an oversized (but validated) derivation waits for exclusive use of the budget and then runs alone rather than deadlocking.