# Comparison with `bumpalo`

[`bumpalo`](https://crates.io/crates/bumpalo) is the closest crate in
spirit; here's how multitude differs.

| Capability                                              | `bumpalo`                      | `multitude`                                                                                                                     |
|---------------------------------------------------------|--------------------------------|---------------------------------------------------------------------------------------------------------------------------------|
| Bump allocation                                         |||
| Simple references (`&'arena mut T`)                     |`Bump::alloc`                |`Arena::alloc`                                                                                                                |
| `Allocator` trait integration                           | ✅ via `allocator-api2`         | ✅ via `allocator-api2`                                                                                                          |
| Reclamation granularity                                 | Whole arena at reset           | **Per chunk**, as refcounts hit 0 (refcount smart pointers); whole-arena (simple references)                                    |
| Refcounted smart pointers                               | ❌ (raw `&'bump T`)             |`Arc` (atomic; thread-safe sharing)                                                                                            |
| Smart pointers outlive the arena                        || ✅ (`Arc` / `Box` and their `str` variants — simple references are lifetime-bound)                                               |
| Cross-thread sharing of individual values               || ✅ via `Arc`                                                                                                                     |
| Automatic per-object `Drop`                             | Only via `bumpalo::boxed::Box` | ✅ Automatic (refcount smart pointers drop at chunk teardown; `Box` drops at smart pointer drop; simple references drop at arena drop) |
| Owned single smart pointer (`Drop` on drop)             | `bumpalo::boxed::Box`          | `Box`                                                                                                                           |
| Smart-pointer width                                     | 16 bytes for fat DSTs (`&str`, `Bump-allocated boxed slice` are 2-word) | **8 bytes uniformly**`Arc<T>` / `Box<T>` are thin even for DST `T` (slice / `str` / `dyn Trait` / custom `Pointee`); DST metadata is stored unaligned in a chunk prefix |
| Single-pointer string smart pointers                    | ❌ (`&str` is 16 bytes)         |`Arc<str>` / `Box<str>` / `ArcUtf16Str` / `BoxUtf16Str` are all 8 bytes (length stored unaligned in a `usize` prefix in the chunk; zero per-string padding) |
| Growable collections                                    |`bumpalo::collections`       |`Vec` (in `multitude::vec`), `String` (in `multitude::strings`)                                                               |
| In-place growth of `Vec` / `String`                     | ❌ (every reserve copies the existing payload to a fresh, larger allocation) | ✅ Extends the existing allocation in place when its tail still sits at the chunk's bump cursor — no copy, no relocation; falls back to copy only when later allocations have moved the cursor past it |
| `format!`-style macro                                   |||
| UTF-16 strings                                          || ✅ via `ArcUtf16Str` / `BoxUtf16Str` / `Utf16String` (gated on the `utf16` feature)                               |
| Dynamically-sized types (DSTs, e.g. `dyn Trait`, `[T]`) || ✅ via the `dst` module (gated on the `dst` feature)                                                                             |
| `zerocopy` integration                                  || ✅ Zero-initialized allocations for `FromZeros` types (gated on the `zerocopy` feature)                                          |
| `bytemuck` integration                                  || ✅ Zero-initialized allocations for `Zeroable` types (gated on the `bytemuck` feature)                                           |
| `bytes` integration                                     ||`From<Arc<[u8]>>` / `From<Arc<str>>` into `bytes::Bytes` for zero-copy Tokio / Hyper interop (gated on the `bytes` feature)     |
| `bytesbuf` integration                                  || ✅ Arena implements `bytesbuf::mem::Memory` for arena-backed byte buffers (gated on the `bytesbuf` feature)                      |
| `serde` integration                                     ||`Serialize` impls for `Arc<str>`, `Box<str>`, `String`, `Vec` (+ UTF-16 types with `serde + utf16`); gated on the `serde` feature           |
| Runtime allocation statistics                           ||`Arena::stats()` returns chunk counts, total bytes, and relocation counters (gated on the `stats` feature)                    |
| `#![no_std]`                                            |||