hn.today

A new way to manage memory: no garbage collection, extremely fast & safe access

ulanguage.org13 points3 comments
Screenshot of A new way to manage memory: no garbage collection, extremely fast & safe access

The design replaces tracing garbage collection with a DAG ownership model and owner-scoped slab chains: parents hold strong references to children, back-references are annotated +R(parent) and treated as weak, and a static linter rejects cycles without a parent edge. Deallocation is subtree-scoped so cost is proportional to owned allocation, not total heap size. Each owner allocates into a chain of power-of-two slabs (bump-pointer within a slab; new slab doubles size), so n bytes occupy at most ⌈log₂(n/initial)⌉ slabs and deallocation is O(log n) in worst case but effectively constant for typical scopes. Dynamic values use 8-byte NaN-boxed tagged representations so integers, pointers, booleans, None and tombstones fit a single word. Lists use stable power-of-two slabs that never relocate existing entries, giving O(1) random access via bit operations.

Map access treats index → (key,value) as authoritative and avoids unnecessary reverse lookup: iterator provenance, compiler-constant keys (symbols), and shared insertion shapes provide cached stable indices. Deletions write tombstones; reinsertion semantics (append-on-reinsert vs revive) are a language policy. Stable indices belong to storage generations and are invalidated only when the index→entry mapping changes; resolver compaction reorganizes reverse-index metadata without renumbering storage. Residual dynamic lookup is handled by a two-stage pipeline - deterministic key hashing → per-Map resolver → candidate stable indices → exact equals check - with resolvers evolving from SIMD scans to SwissTable or ART, assisted by bloom/negative-membership filters and generational strategies to avoid moving historical data.

Read on ulanguage.org3 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Security

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.