# Initial ArenaAllocator node capacity

**URL:** <https://ziggit.dev/t/initial-arenaallocator-node-capacity/18471>\
**Category:** Help\
**Tags:** memory-management\
**Created:** [November 15, 2026, 5:27pm UTC](https://ziggit.dev/t/initial-arenaallocator-node-capacity/18471 "2026-11-15T17:27:36Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![gwenzek](https://ziggit.dev/user_avatar/ziggit.dev/gwenzek/32/8137_2.png) [@gwenzek](https://ziggit.dev/u/gwenzek)\
**Post date:** [November 15, 2026, 7:37pm UTC](https://ziggit.dev/t/initial-arenaallocator-node-capacity/18471/2 "2026-11-15T19:37:55Z")

</div>

You can explicitly grow the arena when creating by using `alloc(u8, 4096); free`

I agree that it should come in the std.

slightly optimized version of the above: [zml/stdx/stdx.zig at 8fcff8c462070d06056f8a85ba0c8a81f0f3a636 · zml/zml · GitHub](https://github.com/zml/zml/blob/8fcff8c462070d06056f8a85ba0c8a81f0f3a636/stdx/stdx.zig#L33)

```zig
pub fn arenaWithCapacity(parent: std.mem.Allocator, initial_capacity: usize) std.mem.Allocator.Error!std.heap.ArenaAllocator {
    var a: std.heap.ArenaAllocator = .init(parent);

    _ = try a.allocator().alloc(u8, initial_capacity);
    std.debug.assert(a.state.used_list.?.end_index == initial_capacity);
    a.state.used_list.?.end_index = 0;
    return a;
}

```

---

_[View the full topic](https://ziggit.dev/t/initial-arenaallocator-node-capacity/18471)._
