munmap()¶
Purpose¶
Unmaps a memory mapping created by mmap().
Header¶
Prototype¶
Parameters¶
addr: start address returned bymmap().length: mapping length.
Return Value¶
- Success: returns
0. - Failure: returns
-1and setserrno.
Minimal Example¶
Common Pitfalls¶
- Use the same length that was used for
mmap(). - Do not access the pointer after
munmap(). munmap()does not remove a POSIX shared memory object; useshm_unlink()for that.