From 5bb4fef30a1b12fde3e3a20c2def301f7fd32fab Mon Sep 17 00:00:00 2001 From: godalming123 <68993177+godalming123@users.noreply.github.com> Date: Tue, 25 Mar 2025 06:19:28 +0000 Subject: [PATCH] Update the documentation comment in arena_allocator.zig to be more accurate Update the documentation comment in arena_allocator.zig to specify that free() is a no-op unless the item is the most recent allocation. --- lib/std/heap/arena_allocator.zig | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/std/heap/arena_allocator.zig b/lib/std/heap/arena_allocator.zig index 15d9044479..f88bb7de16 100644 --- a/lib/std/heap/arena_allocator.zig +++ b/lib/std/heap/arena_allocator.zig @@ -3,8 +3,10 @@ const assert = std.debug.assert; const mem = std.mem; const Allocator = std.mem.Allocator; -/// This allocator takes an existing allocator, wraps it, and provides an interface -/// where you can allocate without freeing, and then free it all together. +/// This allocator takes an existing allocator, wraps it, and provides an interface where +/// you can allocate and then free it all together. Calls to free an individual item only +/// free the item if it was the most recent allocation, otherwise calls to free do +/// nothing. pub const ArenaAllocator = struct { child_allocator: Allocator, state: State,