diff --git a/lib/std/mem/Allocator.zig b/lib/std/mem/Allocator.zig index 0d4ab9141f3a8e9e47fa591c62b65847daa092da..8aea197d6ae8d019094ca1320fa9e625bd089cc4 100644 --- a/lib/std/mem/Allocator.zig +++ b/lib/std/mem/Allocator.zig @@ -301,8 +301,9 @@ pub fn reallocAdvanced( return mem.bytesAsSlice(T, new_bytes); } -/// Free an array allocated with `alloc`. To free a single item, -/// see `destroy`. +/// Free an array allocated with `alloc`. +/// If memory has length 0, free is a no-op. +/// To free a single item, see `destroy`. pub fn free(self: Allocator, memory: anytype) void { const Slice = @typeInfo(@TypeOf(memory)).pointer; const bytes = mem.sliceAsBytes(memory);