Deletes the mappings for the specified address range, causing further references to addresses within the range to generate invalid memory references. Note that while POSIX allows unmapping a region in the middle of an existing mapping, Zig's munmap function does not, for two reasons:
pub fn munmap(memory: []align(page_size_min) const u8) void
pub fn munmap(memory: []align(page_size_min) const u8) void {
switch (errno(system.munmap(memory.ptr, memory.len))) {
.SUCCESS => return,
.INVAL => unreachable, // Invalid parameters.
.NOMEM => unreachable, // Attempted to unmap a region in the middle of an existing mapping.
else => |e| if (std.options.unexpected_error_tracing) {
std.debug.panic("unexpected errno: {d} ({t})", .{ @backingInt(e), e });
} else unreachable,
}
}