MCPcopy Create free account
hub / github.com/argumentcomputer/ix / clear_releasing_memory

Method clear_releasing_memory

crates/kernel/src/env.rs:577–601  ·  view source on GitHub ↗

Clear worker-local state and drop backing allocations. `clear()` preserves `HashMap` capacity, which is useful for reuse but problematic for full-env checking: one very large block can permanently ratchet a worker's retained cache allocation. This variant is for scheduled-block boundaries where memory pressure matters more than preserving buckets for the next unrelated block.

(&mut self)

Source from the content-addressed store, hash-verified

575 /// Computed `is_rec` per inductive, keyed by content address
576 pub is_rec_cache: FxHashMap<Address, bool>,
577 /// Generated recursors, keyed by inductive Muts block id.
578 pub recursor_cache: FxHashMap<KId<M>, Vec<GeneratedRecursor<M>>>,
579 /// Nested-auxiliary order expected by stored recursors in this environment.
580 pub recursor_aux_order: RecursorAuxOrder,
581 /// Maps the set of major inductive KIds to the inductive block id.
582 pub rec_majors_cache: FxHashMap<BTreeSet<KId<M>>, KId<M>>,
583 /// Mutual-block peer-agreement cache: records block ids whose peers have
584 /// already been verified to share the same universe (S3) and parameter
585 /// prefix (S3b). Populated by `check_inductive` after the per-peer loop
586 /// succeeds; collapses the naturally O(N²) per-peer iteration to O(N)
587 /// total work per block across all the peers' individual checks.
588 pub block_peer_agreement_cache: FxHashSet<KId<M>>,
589 /// Whole-block type-check results. Both successes and failures are cached,
590 /// so every member of a bad block reports the same structured failure.
591 pub block_check_results: FxHashMap<KId<M>, Result<(), TcError<M>>>,
592
593 /// Primitive-reducer family per head-constant address (see
594 /// `whnf.rs::PrimFamily`). Pure function of the address; memoized so
595 /// the WHNF loops classify each head with one map probe instead of a
596 /// ~30-address compare gauntlet across five recognizers.
597 pub prim_family_cache: FxHashMap<Address, super::whnf::PrimFamily>,
598
599 /// Next free-variable id for checker-local binder openings.
600 ///
601 /// Type-checking caches live on `KEnv`, not on one `TypeChecker`, so FVar
602 /// ids must also be allocated from the shared environment. Otherwise two
603 /// checker instances could both mint `fv$0` and reuse an `infer(fv$0)` cache
604 /// entry under different local contexts.

Callers 4

run_anon_checks_parallelFunction · 0.80
check_consts_loopFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected