[package]
name = "nordisk-alloc"
version = "0.1.0"
edition = "2021"
description = "The ONE long-lived-server allocator policy for the nordisk constellation — installs mimalloc AND tells it to hand freed memory back to the OS (`purge_delay` 10 ms, `arena_purge_mult` 1) so a dropped transient stops being resident forever. REUSE (LAW #5): mimalloc `0.1` compiles the v3 C sources, and v3 raised `purge_delay` from 10 ms to 1000 ms — at which point RSS is not memory in use but the running MAXIMUM of every transient the process ever built. MEASURED: a 2 GB transient dropped at the shipped default returned 0 bytes; at 10 ms it returned all but 156 MB. Every fat nordisk binary (dwarves-server, nornir-server, korp-server, holger, gunnar-service) wants this, and until now exactly one of them had it."
license = "MIT OR Apache-2.0"
repository = "https://git.gunnar.rs/nordisk/edda"
keywords = ["mimalloc", "allocator", "rss", "memory", "oom"]
categories = ["memory-management"]
exclude = ["/.nornir/"]
[features]
default = []
# `testmatrix` — emit each surface's health (the env ladder, the option-row
# fingerprint, the real write) into the nornir test-matrix via
# `functional_status`. OFF BY DEFAULT: a compiled-out no-op with no nornir dep,
# so a lean/release build carries neither the emitter nor testmatrix.
testmatrix = ["dep:nornir-testmatrix", "nornir-testmatrix/testmatrix"]
[dependencies]
# THE allocator this leaf exists to configure, re-exported as
# `nordisk_alloc::MiMalloc` so a consumer needs ONE dependency to both install it
# and tune it. A final artifact still declares its own `#[global_allocator]` —
# only an artifact may — but it no longer needs a second crate to name the type.
mimalloc = "0.1"
# The `extended` API (`mi_option_get` / `mi_option_set`). The tuning CANNOT be done
# through `MIMALLOC_PURGE_DELAY` from inside `main`: mimalloc latches each option on
# first read and `purge_delay` is already read during pre-`main` allocation
# (MEASURED — see the module docs). Feature unification keeps this the SAME
# `libmimalloc-sys` build `mimalloc` above already links, not a second copy.
libmimalloc-sys = { version = "0.1.16", features = ["extended"] }
# Introspection-marker emitter — only compiled with `testmatrix`. Path+version
# (like the other edda leaves) so the workspace resolves the local sibling.
nornir-testmatrix = { version = "0.2.7", path = "../nornir-testmatrix", default-features = false, optional = true }
[dev-dependencies]
# The behavioural cell installs the real allocator as its own `#[global_allocator]`
# — an integration test IS a final artifact, which is what lets it drive exactly what
# a fat binary ships.
mimalloc = "0.1"