···1515defer buf.deinit(alloc); // cleanup when we're done
16161717try buf.print(alloc, "{s}: {d}", .{ name, value });
1818-sendResponse(buf.items); // borrow the slice, arraylist still owns it
1818+sendResponse(buf.items);
1919```
2020+2121+`buf.items` is the `[]u8` slice holding the actual data - a direct view into the arraylist's internal buffer. the arraylist still owns this memory, so don't hold onto it after `deinit`.
20222123**build and return** - you're building something to give to a caller. they'll own the memory:
2224···2830return buf.toOwnedSlice(alloc); // caller must free this
2931```
30323131-the key difference: `.items` gives you a view into the arraylist's memory (it still owns it). `.toOwnedSlice()` hands ownership to you (arraylist forgets about it, you must free it).
3333+the key difference: `.items` borrows (arraylist still owns the memory, will free on `deinit`). `.toOwnedSlice()` transfers ownership (arraylist forgets about it, caller must free).
32343335see: [dashboard.zig#L187](https://tangled.sh/@zzstoatzz.io/music-atmosphere-feed/tree/main/src/dashboard.zig#L187) for the return pattern
3436