Function munmap [src]

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: It violates the Zig principle that resource deallocation must succeed. The Windows function, VirtualFree, has this restriction.

Prototype

pub fn munmap(memory: []align(page_size_min) const u8) void

Parameters

memory: []align(page_size_min) const u8

Source

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 => unreachable, } }