Zig 0.17.0-dev (Split by item) This is an example of documentation generated by
ZigDoc , an alternative to Zig's built-in
Auto Doc feature. See also
examples in other modes/formats . The project being documented here (as the example) is the Zig standard library.
std › heap › debug_allocator › DebugAllocator › reportDoubleFree Private Function reportDoubleFree Doc Source Private Function std.heap.debug_allocator.DebugAllocator.reportDoubleFree
fn reportDoubleFree (ret_addr : usize , alloc_stack_trace : StackTrace , free_stack_trace : StackTrace ) void Params File heap/debug_allocator.zig: 514
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532 fn reportDoubleFree (ret_addr : usize , alloc_stack_trace : StackTrace , free_stack_trace : StackTrace ) void {
@branchHint (.cold );
var addr_buf : [stack_n ]usize = undefined ;
const second_free_stack_trace = std .debug .captureCurrentStackTrace (.{ .first_address = ret_addr }, &addr_buf );
log .err ("Double free detected. Allocation: {f} First free: {f} Second free: {f}" , .{
std .debug .FormatStackTrace {
.stack_trace = alloc_stack_trace ,
.terminal_mode = std .log .terminalMode (),
},
std .debug .FormatStackTrace {
.stack_trace = free_stack_trace ,
.terminal_mode = std .log .terminalMode (),
},
std .debug .FormatStackTrace {
.stack_trace = second_free_stack_trace ,
.terminal_mode = std .log .terminalMode (),
},
});
}