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.
This commit is contained in:
godalming123 2025-03-25 06:19:28 +00:00 committed by GitHub
parent 525466b49d
commit 5bb4fef30a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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,