Zig: [question] std.mem.ArrayList.toOwnedSlice

Created on 18 Sep 2018  路  2Comments  路  Source: ziglang/zig

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?

question

Most helpful comment

Yes. That's why it's Owned.

All 2 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andrewrk picture andrewrk  路  3Comments

DavidYKay picture DavidYKay  路  3Comments

daurnimator picture daurnimator  路  3Comments

andrewrk picture andrewrk  路  3Comments

bronze1man picture bronze1man  路  3Comments