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 › ArenaAllocator › FuzzContext › doOneFree Private Function doOneFree Doc Source Private Function std.heap.ArenaAllocator.FuzzContext.doOneFree
fn doOneFree (ctx : *FuzzContext ) void Params File heap/ArenaAllocator.zig: 969
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994 fn doOneFree (ctx : *FuzzContext ) void {
@disableInstrumentation ();
const index = @atomicRmw (Alloc .Index , &ctx .last_alloc_index , .Xchg , .none , .acquire );
if (index == .none ) return ;
const allocation = &ctx .allocs [@backingInt (index )];
assert (allocation .common .len != .free );
const len : usize = @backingInt (allocation .common .len );
const alignment = allocation .common .alignment ;
assert (alignment .check (@intFromPtr (allocation .control_ptr )));
assert (alignment .check (@intFromPtr (allocation .sample_ptr )));
ctx .control_allocator .rawFree (allocation .control_ptr [0 ..len ], alignment , @returnAddress ());
ctx .sample_allocator .rawFree (allocation .sample_ptr [0 ..len ], alignment , @returnAddress ());
ctx .allocs [@backingInt (index )] = .{
.control_ptr = undefined ,
.sample_ptr = undefined ,
.common = .{
.len = .free ,
.alignment = .@"1" ,
},
};
}