authorgravatar for _@gr.htGregory Mullen <_@gr.ht> 2023-08-20 12:22:53-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-08-21 11:22:22-07:00
logf74e10cd4722512ac671f574b3d274ab48abb1a7
treea2cf1f798c7f4dc7375efd70d94fc0d82f254838
parent8e96be0088d4ae007589651066d426f815aaab4f

Update default stack frames for general_purpose_allocator.zig

Created from a conversation with @andrewrk on irc: Memory leaks when using ArrayList can be inconvenient to debug when the stack frame size is 4 because the entirety of the printed frame is within zig stdlib, and not in the users calling stack. Increasing this to 6 for Debug builds, gives 2 frames of user code. I increased the frame size for tests as well by the equivalent factor, but I'm unconvinced that's actually desirable.

1 files changed, 1 insertions(+), 1 deletions(-)

lib/std/heap/general_purpose_allocator.zig+1-1
......@@ -105,7 +105,7 @@ const StackTrace = std.builtin.StackTrace;
105105/// Integer type for pointing to slots in a small allocation
106106const SlotIndex = std.meta.Int(.unsigned, math.log2(page_size) + 1);
107107
108const default_test_stack_trace_frames: usize = if (builtin.is_test) 8 else 4;
108const default_test_stack_trace_frames: usize = if (builtin.is_test) 10 else 6;
109109const default_sys_stack_trace_frames: usize = if (std.debug.sys_can_stack_trace) default_test_stack_trace_frames else 0;
110110const default_stack_trace_frames: usize = switch (builtin.mode) {
111111 .Debug => default_sys_stack_trace_frames,