Skip to content

feat(memory): adopt mimalloc allocator - #1

Closed
randomvariable wants to merge 1 commit into
priorityqueuefrom
memory-mimalloc
Closed

feat(memory): adopt mimalloc allocator#1
randomvariable wants to merge 1 commit into
priorityqueuefrom
memory-mimalloc

Conversation

@randomvariable

Copy link
Copy Markdown
Owner

Purpose

Replace the platform allocator-specific telemetry and reclamation paths with one cross-platform mimalloc backend. This PR stacks on cortexkit#283.

Changes

  • install mimalloc as the Rust global allocator in production and allocation-counted tests
  • derive allocator requested, committed, and retained-byte telemetry from mimalloc statistics
  • replace mallinfo2, malloc_trim, and macOS zone relief with forced mi_collect
  • retain the detached aft-mem-relief thread and the existing transport-thread cadence gate
  • trigger forced collection after idle artifact eviction
  • report reclaimed residency using allocator commitment or observed RSS reduction
  • document the allocator backend and collection flow

Verification

  • allocator contracts: 9 passed
  • forced warm-then-idle experiment reclaimed 64,024,576 bytes of RSS
  • cargo check -p agent-file-tools --all-targets
  • cargo fmt --all -- --check
  • git diff --check

Scope

This PR changes allocator ownership and reclamation only. Explicit subsystem budgets, charge-before-build admission, and cache eviction policy remain separate work.

Signed-off-by: Naadir Jeewa <naadir@randomvariable.co.uk>
Co-authored-by: alfonso-aft <289616620+alfonso-aft@users.noreply.github.com>
@randomvariable

Copy link
Copy Markdown
Owner Author

Superseded by cortexkit#285.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant