It is often worth it to use way more memory than you need to if that memory can remain on the stack.
Hard to leak memory that you never allocate. Use std.BoundedArray
and it's assumeCapacity
methods
alot. Operating systems have a max file path. If I'm able to put that many bytes on the stack
I should never have to return OutOfMemory
, unless it's an invalid value altogether
var source = std.BoundedArray(u8, std.fs.MAX_PATH_BYTES).init(0) catch unreachable;
try switch (source_json) {