is the slice obtained by std.mem.ArrayList.toOwnedSlice backed by the heap and not calling std.mem.Allocator.free on it a memory leak?
Yes. That's why it's Owned.
In case you didn't see it, there is also toSlice() and toSliceConst() which do not obtain ownership.
Most helpful comment
Yes. That's why it's
Owned.