This only happens when my code is run in debug mode
I am trying to parse a json file that is about 56kb into a data structure. however it always segmentation faults in debug mode.
I think it has something to do with stack overflows, however I am not sure what I can do to fix this
pub fn readLevel(a: std.mem.Allocator, save_id: []const u8, level_id: []const u8) !level.Level {
const path = try getLevelPath(a, save_id, level_id);
const max_bytes = 10000000; //maximum bytes in a level save file
const string = try std.fs.cwd().readFileAlloc(a, path, max_bytes);
if (!try std.json.validate(a, string)) {
return error.invalid_json;
}
//this line segfaults
return try std.json.parseFromSliceLeaky(level.Level, a, string, .{ .allocate = .alloc_always });
}
The debugger backtrace is included in the attached file