feat(memory): adopt mimalloc allocator - #285
Conversation
Bound interactive and maintenance queues, carry request deadlines across the SubC transport, and yield standing-root maintenance when cold-build capacity is saturated. Demote maintenance workers so reader latency remains stable under index load. Signed-off-by: Naadir Jeewa <naadir@randomvariable.co.uk>
Signed-off-by: Naadir Jeewa <naadir@randomvariable.co.uk> Co-authored-by: alfonso-aft <289616620+alfonso-aft@users.noreply.github.com>
Use pressure-aware deficit round robin to rotate standing roots across bounded search, semantic, and callgraph work. Preserve laptop responsiveness by default while allowing an explicit performance policy. Signed-off-by: Naadir Jeewa <naadir@randomvariable.co.uk> Co-authored-by: alfonso-aft <289616620+alfonso-aft@users.noreply.github.com>
Bound Pi-facing requests below the host deadline, move allocator scans off the transport thread, and avoid repeated standing-root reconciliation. Signed-off-by: Naadir Jeewa <naadir@randomvariable.co.uk>
Signed-off-by: Naadir Jeewa <naadir@randomvariable.co.uk> Co-authored-by: alfonso-aft <289616620+alfonso-aft@users.noreply.github.com>
Signed-off-by: Naadir Jeewa <naadir@randomvariable.co.uk>
Signed-off-by: Naadir Jeewa <naadir@randomvariable.co.uk> Co-authored-by: alfonso-aft <289616620+alfonso-aft@users.noreply.github.com>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Thank you - the stack structure is understood (reviewing only 692c81e; the deep pass holds until #283 lands, same as its own review). One architectural question worth answering early because it shapes the whole design: mimalloc installed as the Rust global allocator captures Rust-side allocations only. A significant share of this daemon's resident footprint allocates through C malloc - SQLite page caches, tree-sitter trees, ONNX Runtime tensors - and those do not route through a Rust Also confirming: the memory telemetry fields consumed by the fleet health surface ( |
Signed-off-by: Naadir Jeewa <naadir@randomvariable.co.uk> Co-authored-by: alfonso-aft <289616620+alfonso-aft@users.noreply.github.com>
Purpose
Adopt mimalloc for Rust-owned heap allocations while preserving native allocator relief and process-level telemetry.
Stacked on #283. Review only commits
692c81e2and36f6c668until #283 merges.Changes
mi_collect(true)after idle eviction and from the detached allocator-maintenance threadmalloc_trim(0)on glibc andmalloc_zone_pressure_reliefon macOS for native libraries that bypass RustGlobalAllocCoverage boundary
mimalloc statistics cover Rust-owned heap allocations. SQLite, tree-sitter, ONNX Runtime, and other native libraries can still allocate through the platform allocator. RSS, macOS physical footprint, SQLite bytes, and subsystem estimates remain independent process checks.
Verification
cargo check -p agent-file-tools --all-targetscargo fmt --all -- --checkgit diff --checkThe realistic multi-root benchmark protocol is committed without results. Both allocator arms still require paired representative-host runs before an allocator performance claim.
Scope
This PR changes allocator ownership and reclamation only. Explicit subsystem budgets, charge-before-build admission, and cache eviction policy remain separate work.
Contribution
AI-assisted implementation and verification with OpenAI Codex through Oh My Pi. The author reviewed the changes and test evidence.