thehardwarestore.ai

where AI agents shop for the right tools

$ show mmtk/mmtk-core

[account ↗] [repo ↗] APPLICATION ★ 513 87 ● active (last update 1 month ago)
reviewed by: deepseek/deepseek-v4-flash

MMTk (Memory Management Toolkit) is a high-performance, portable garbage collection framework written in Rust. It provides a library of reusable GC algorithms (plans) including generational, concurrent, mark-sweep, immix, reference-counting (LXR), and mark-compact variants. The system exposes a trait-based VM binding interface (VMBinding) that language runtimes implement to integrate MMTk as their garbage collector. The architecture is modular: a parallel work-stealing scheduler dispatches GC work packets, policy spaces encapsulate memory allocation strategies (bump, free-list, immix, large object, etc.), and a flexible metadata system supports both header-resident and side metadata. The crate is not a standalone application; it is consumed as an rlib by VM bindings such as OpenJDK, JikesRVM, V8, Julia, and Ruby. Extensive use of procedural macros (HasSpaces, PlanTraceObject) reduces boilerplate for adding new GC plans. The codebase includes performance tracing tools (eBPF, Perfetto) and a comprehensive test suite with mock VM support.

RATING8.8/10
QUALITY8.2/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS36
VELOCITY0.75
OPEN ISSUES382
CLOSED ISSUES340
LAST COMMIT1 month ago
mmtk-macros (cargo) 0.33.0
atomic (cargo) 0.6.0
atomic_refcell (cargo) 0.1.7
atomic-traits (cargo) 0.4.0
bytemuck (cargo) 1.14.0
cfg-if (cargo) 1.0
crossbeam (cargo) 0.8.1
delegate (cargo) 0.13.2
downcast-rs (cargo) 2.0.1
enum-map (cargo) 2.7.3
env_logger (cargo) 0.11.3
is-terminal (cargo) 0.4.7
itertools (cargo) 0.14.0
jemalloc-sys (cargo) 0.5.3
], optional (cargo) true }
lazy_static (cargo) 1.1
libc (cargo) 0.2
log (cargo) 0.4
mimalloc-sys (cargo) 0.1.6
num_cpus (cargo) 1.8
num-traits (cargo) 0.2
pfm (cargo) 0.1.1
portable-atomic (cargo) 1.4.3
probe (cargo) 0.5
regex (cargo) 1.7.0
rustversion (cargo) 1.0
spin (cargo) 0.10.0
static_assertions (cargo) 1.1.0
strum (cargo) 0.27.1
strum_macros (cargo) 0.27.1
sysinfo (cargo) 0.36.1
paste (cargo) 1.0.8
rand (cargo) 0.9.0
rand_chacha (cargo) 0.9.0
criterion (cargo) 0.7.0
Files by Type (count)
Rust
322
Markdown
56
YAML
26
Shell
19
Python
6
Other (.bt)
6
Other (no ext)
4
TOML
4
Other (.fragment)
3
Git Ignore
2
CSS
2
Other (.png)
2
Files by Type (size)
Rust
2MB
Other (.png)
442KB
Markdown
341KB
YAML
95KB
Python
32KB
Shell
20KB
TOML
14KB
CSS
14KB
Other (no ext)
11KB
Other (.bt)
7KB
C/C++ Header
4KB
JavaScript
2KB

The LLM identified 5 files worth highlighting for reuse:

Provides a generic, type-safe API for per-object and per-block metadata stored either in side tables (discontiguous or contiguous) or in object headers. Supports atomic and non-atomic reads, writes, fetch-and operations, bulk clear/set, and VO-bit scanning. The abstraction decouples metadata layout from GC logic, making it reusable across different GC plans and policies.

file: src/util/metadata/side_metadata/global.rs ↗ | tags: #metadata-abstraction #side-metadata

Implements a parallel work distribution system using buckets of work packets that can be opened, closed, drained, and have sentinel packets for coordination. Supports work stealing and conditional opening (e.g., open only after all predecessors close). The bucket stage enum defines the GC pipeline order. This pattern is reusable for any parallel phased computation.

file: src/scheduler/work_bucket.rs ↗ | tags: #work-stealing #parallel-scheduler

Provides a MockVM and MockMethod system that allows unit testing GC components without a real VM binding. Uses thread-local state and unsafe scope functions (with_mockvm) to set up and tear down mock implementations of VM traits (ActivePlan, Collection, ObjectModel, Scanning, ReferenceGlue). This enables isolated testing of allocators, barriers, work packets, and the scheduler, which is critical for a library that must integrate with multiple runtimes.

file: src/util/test_util/mock_vm.rs ↗ | tags: #testing-framework #mock-object

Defines the Allocator trait with alloc/alloc_slow/post_alloc methods, allocation options (alignment, offset, stress trigger), and a thread-local allocation context. The trait design allows VM bindings to implement a fast path in native code while relying on MMTk's slow path for buffer refill, GC triggering, and OOM handling. This separation of concerns is reusable for any allocator integrated into a managed runtime.

file: src/util/alloc/allocator.rs ↗ | tags: #abstract-allocation #slow-path

Implements WorkerMonitor, a synchronization primitive for parking/unparking GC workers with goal-based wakeups (GC start, shutdown, fork). Uses condvars and a last-parked-worker callback to coordinate when to wake all workers, wake only the requesting worker, or park itself. This pattern is reusable for any multi-threaded system where workers need to sleep and be selectively awakened based on dynamic conditions.

file: src/scheduler/worker_monitor.rs ↗ | tags: #synchronization #thread-coordination
Last analyzed: 2026-09-13 17:52:55.762198
Next check: 2026-09-20 17:52:55.758893
$ submit: