Skip to content

Repository files navigation

Arena Allocator (Go)

A custom memory allocator for Go, using arena-style allocation and an optional sharded design for concurrency. It’s a clean, dependency-free implementation focused on speed, predictability, and simple lifetimes (allocate many; free all at once, or via marks).

This project demonstrates:

  • bump-pointer arenas (contiguous regions, super fast)
  • mmap-backed allocation (large regions)
  • thread-safe “safe arena”
  • sharded arenas for parallel workloads
  • unit tests & benchmarks
  • simple demo apps

Note: The earlier guarded arena (debug build with mprotect) was removed to keep the project simple.


🚀 Features

  • Arena-based allocation: contiguous region with bump pointer
  • Marks & release: reclaim allocations back to a previous point
  • Thread-safe mode: SafeArena with internal sync
  • Sharding: multiple arenas for multi-core concurrency
  • Typed helpers: allocate typed values and slices
  • Zero dependencies: pure Go
  • Tests & Benchmarks: go test, -bench, -benchmem
  • Makefile: easy build/run/test/bench/fmt/vet/clean

📦 Getting Started

git clone https://github.com/joss12/arena-allocator.git
cd arena-allocator
go mod tidy
go test -bench=. -benchmem

About

Blazing Arena Allocation Memory built in Go

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages