
# Rallocator
[](https://crates.io/crates/rallocator)
[](https://docs.rs/rallocator)
[](https://crates.io/crates/rallocator)
[](https://github.com/microsoft/oxidizer/actions/workflows/main.yml)
[](https://codecov.io/gh/microsoft/oxidizer)
[](https://github.com/microsoft/oxidizer/blob/main/LICENSE)
A pure-Rust, high-performance allocator with scoped heaps and telemetry.
## Supported platforms
`rallocator` currently supports Windows and Linux. Other operating systems
are outside the crate’s public support contract and intentionally fail to
compile. Miri uses an internal test backend and is not a production support
target.
## Usage
### General use
Install the standard configuration as the process-global allocator:
```rust
rallocator::rallocator!();
```
The macro declares the required `#[global_allocator]` static and contains
the unsafe call to [`Rallocator::new`][__link0], whose process-wide
same-configuration invariant it establishes by construction.
Ordinary allocations then use each thread’s implicit general heap. To group
related allocations, use an [`allocation_hints`][__link1] prospective heap. These
handles publish only a thread-local request. Rallocator lazily realizes the
request and retains a bounded per-thread cache for later reattachment:
```rust
use allocation_hints::heaps::{Heap, bump};
use allocation_hints::with_hint;
rallocator::rallocator!();
let heap = Heap::bump(bump::Options::new());
let values = with_hint(&heap, || vec![1, 2, 3]);
assert_eq!(values.len(), 3);
```
If another global allocator is installed, the same code remains valid and
the hint may be ignored.
### Telemetry
Telemetry is opt-in at compile time through [`rallocator!`][__link2]:
```rust
use seismograph::recorder::{Configuration, RecordingPolicy};
rallocator::rallocator!();
fn main() -> Result<(), Box