# Patterns/arena Allocator

> Arena Allocator Pattern (C-Specific) pattern for C development

- Skill: `diegosouzapw/patterns-arena-allocator` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add diegosouzapw/patterns-arena-allocator`
- Raw SKILL.md: https://api.skillmd.com/api/skills/diegosouzapw/patterns-arena-allocator/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: diegosouzapw (https://skillmd.com/u/diegosouzapw)
- Updated: 2026-09-08
- Page: https://skillmd.com/skills/diegosouzapw/patterns-arena-allocator

---


# Arena Allocator Pattern (C-Specific)

Allocate many objects from single memory region, free all at once. No individual frees. Hierarchical arenas enable nested lifetimes.

## ikigai Application

**talloc:** ikigai uses talloc for hierarchical arenas:
```c
TALLOC_CTX *request_ctx = talloc_new(parent);
// All allocations are children
char *str = talloc_strdup(request_ctx, "hello");
ik_msg_t *msg = talloc(request_ctx, ik_msg_t);
// Single free cleans everything
talloc_free(request_ctx);
```

**Ownership hierarchy:**
```
root_ctx
  └─> repl_ctx
       └─> scrollback (freed with repl)
       └─> messages[] (freed with repl)
```

**Benefits:** No memory leaks by design. No use-after-free. Clear ownership. Fast bulk deallocation.

**See:** `project/memory.md` for talloc patterns.

