Back to browse
GitHub Repository

Rust Memory Hypervisor implementing asynchronous metadata offloading, hardware-enforced spatial safety, and virtual memory page compaction.

14 starsRust

Aethalloc – lock-free Rust memory allocator for Linux

by section_me·Mar 18, 2026·3 points·2 comments

AI Analysis

●●●BangerWizardryBig Brain

O(1) anti-hoarding with atomic CAS beats glibc 26% on packet processing, 9x less fragmentation.

Strengths
  • 14 thread-local size classes with batch transfer preventing memory bloat in async pipelines
  • Real benchmarks: 622K ops/s on multi-WAN router, 24MB RSS vs glibc on desktop
  • LD_PRELOAD injection works as drop-in replacement without code changes
Weaknesses
  • Linux-only with no Windows or macOS support mentioned
  • Memory allocator space dominated by jemalloc, mimalloc with years of production testing
Target Audience

Systems programmers, network engineers, Rust developers

Similar To

jemalloc · mimalloc · tcmalloc

Post Description

Hi HN,

I've built aethalloc (https://github.com/shift/aethalloc). It's a high-performance, drop-in memory allocator I wrote in Rust.

To be honest, standard allocators were absolutely choking on my NixOS router/firewall. They were hoarding memory like mad because packets get allocated on an RX thread and freed on a worker thread, basically knackering standard thread-local caches. It was also causing some serious RSS bloat on my NixOS laptop. Pure nightmare.

The Fix: O(1) Anti-Hoarding

aethalloc uses 14 thread-local size classes. When an async pipeline starts hoarding memory (like a firewall worker dropping a NIC's packet), aethalloc just punts the excess back to a global pool. It does this all at once with a single atomic Compare-And-Swap (CAS). Sorted.

┌─────────────────────────────────────────────────────────────────┐ │ Thread N Cache ──► heads[14] ──► Anti-Hoarding Threshold (4096) │ │ │ │ │ ▼ │ │ Global Pool ──► Lock-free Treiber Stack (O(1) batch push) │ └─────────────────────────────────────────────────────────────────┘

It also guarantees 16-byte alignment so your AVX/SSE stays safe, and integrates Hardware-Enforced Spatial Safety (ARM MTE, CHERI, x86_64 LAM/UAI). Pretty chuffed with how that turned out.

Usage

Just compile it to a C ABI shared library (libaethalloc.so) and chuck it into your unmodified binaries with a quick LD_PRELOAD.

I'd love to hear your thoughts on the architecture and project in general.

Cheers!

Similar Projects