munmap
munmap is a system call in POSIX-compliant Unix-like systems that removes a memory region from a process’s address space. The call takes two arguments: a starting address and a length, and disables any mappings that cover that range. The pages within the specified region become available for other mappings or memory allocations. For anonymous mappings, the content is discarded; for file-backed mappings, the kernel may write back dirty pages as part of its normal paging behavior. If the unmapping range only partially overlaps an existing mapping, the overlapping portion is unmapped and the remaining parts remain mapped as separate regions.
The address must be aligned to the system’s page size, and the length must be non-zero and
Return value and errors: munmap returns 0 on success and -1 on error, with errno set to