Skip to content

Add transactional Arena checkpoints - #494

Draft
helly25 wants to merge 1 commit into
implement/string-idfrom
implement/arena-checkpoint
Draft

helly25 wants to merge 1 commit into
implement/string-idfrom
implement/arena-checkpoint

Conversation

@helly25

@helly25 helly25 commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

Add borrowed Arena checkpoints that let multi-part operations reclaim an uncommitted byte tail without releasing reusable capacity. This provides the transactional storage primitive needed by fallible arena-backed string interning.

AG;DR

  • Add Arena::Checkpoint, checkpoint(), and rewind().
  • Preserve allocations made before a checkpoint while invalidating and making later storage reusable.
  • Retain reserved blocks and growth progression so rollback does not turn bounded failure handling into allocation churn.
  • Enforce checkpoint ownership through the existing configurable contract mechanism; rewind() is conditionally noexcept when contract violations cannot throw.
  • Document lifetime, invalidation, synchronization, and raw-object-destruction constraints in mbo/memory/ARENA.md.
  • Test empty, nested, and same-block/cross-block checkpoint rollback and storage reuse.

Validation:

  • bazel --output_user_root=/private/tmp/mbo-arena-checkpoint-bazel test //mbo/memory:arena_test

This PR is stacked on #492.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant