Skip to main content

Crate landauer_allocator

Crate landauer_allocator 

Source
Expand description

Pillar: II. PACR field: Λ.

Landauer-on-Drop Global Allocator — the thermodynamic nervous system.

Standalone crate extracted from aevum-core so other crates can depend on Landauer accounting without pulling in the full aevum-core dependency tree.

§Why intercept dealloc?

In Rust, when a variable’s lifetime ends the Drop trait fires and heap memory is returned to the allocator. This deallocation is physically the moment when bits are irreversibly erased — the exact event that Landauer’s principle taxes.

By wrapping every dealloc call we count bits erased continuously, without any application code having to opt in. TGP is not a function you call; it is a law the system cannot escape.

§Safety contract

Each unsafe block below wraps exactly one system-allocator call and one atomic counter increment. There is:

  • No pointer arithmetic
  • No raw memory reads or writes
  • No lifetime violations
  • No data races (AtomicU64 with Relaxed ordering is sound here: we only need monotonicity, not happens-before synchronisation)

Structs§

LandauerAllocator
The Landauer allocator wraps the system allocator and counts bit erasures on every dealloc call.

Functions§

bits_erased
Read the cumulative bits erased since process start.
landauer_cost_joules
Compute the Landauer dissipation cost in joules for bits erased at temperature temperature_k (Kelvin).