Expand description
Memory Management ToolKit (MMTk) is a portable and high performance memory manager that includes various garbage collection algorithms and provides clean and efficient interfaces to cooperate with language implementations. MMTk features highly modular and highly reusable designs. It includes components such as allocators, spaces and work packets that GC implementers can choose from to compose their own GC plan easily.
Logically, this crate includes these major parts:
- GC components:
- Allocators: handlers of allocation requests which allocate objects to the bound space.
- Policies: definitions of semantics and behaviors for memory regions. Each space is an instance of a policy, and takes up a unique proportion of the heap.
- Work packets: units of GC work scheduled by the MMTk’s scheduler.
- GC plans: GC algorithms composed from components.
- Heap implementations: the underlying implementations of memory resources that support spaces.
- Scheduler: the MMTk scheduler to allow flexible and parallel execution of GC work.
- Interfaces: bi-directional interfaces between MMTk and language implementations i.e. the memory manager API that allows a language’s memory manager to use MMTk and the VMBinding trait that allows MMTk to call the language implementation.
Re-exports
pub use crate::plan::AllocationSemantics;
pub use crate::plan::BarrierSelector;
pub use crate::plan::Mutator;
pub use crate::plan::MutatorContext;
pub use crate::plan::ObjectQueue;
pub use crate::plan::Plan;
Modules
- VM-to-MMTk interface: safe Rust APIs.
- mmtk 🔒MMTk instance.
- GC algorithms from the MMTk suite.
- policy 🔒Memory policies that can be used for spaces.
- A general scheduler implementation. MMTk uses it to schedule GC-related work.
- Utilities used by other modules, including allocators, heap implementation, etc.
- MMTk-to-VM interface: the VMBinding trait.
Structs
- An MMTk instance. MMTk allows multiple instances to run independently, and each instance gives users a separate heap. Note that multi-instances is not fully supported yet
Traits
- A GC worker’s copy allocator for copying GCs. Each copying policy should provide their implementation of PolicyCopyContext. If we copy objects from one policy to a different policy, the copy context of the destination policy should be used. For example, for generational immix, the nursery is CopySpace, and the mature space is ImmixSpace. When we copy from nursery to mature, ImmixCopyContext should be used. Note that this trait should only be implemented with policy specific behaviors. Please refer to
crate::util::copy::GCWorkerCopyContext
which implements common behaviors for copying.