Skip to content



munmap - used to unmap/delete a previously mapped region of memory


munmap is a syscall provided by the Linux kernel that is used to unmap/delete a previously mapped region of memory. This can be used to free up memory that was previously allocated for some purpose and is no longer needed. This syscall provides an efficient way for processes to manage their memory usage, as it can free up specific regions of memory that have been mapped, rather than having to free up all the memory and then reallocate the required portions. One of the drawbacks of using this system call is that it can lead to memory fragmentation, as areas of memory are freed individually. This can make it difficult for processes to allocate memory in larger chunks, as there may be a number of small, scattered areas of free memory.


  • addr: void*[K] - Address of a previously mapped memory region in the calling process.
  • length: size_t[K] - Length of the memory region to be unmapped, in bytes. Must match the length of the region that was provided to mmap() during its creation.

Available Tags

  • K - Originated from kernel-space.
  • U - Originated from user space (for example, pointer to user space memory used to get it)
  • TOCTOU - Vulnerable to TOCTOU (time of check, time of use)
  • OPT - Optional argument - might not always be available (passed with null value)






To monitor the unmapping of addressed regions of memory in the kernel.





To monitor the unmapping of addressed regions of memory in user space processes.

Example Use Case

A web server written in C needs to keep track of the addresses of all allocated memory regions as part of its regular clean-up and memory management process. The web server can use the munmap syscall to free-up memory upon the completion of an operation and make the associated address space available for future uses.


No issues have been reported with the munmap syscall.

  • mmap - The sys call used to map a region of memory.
  • mremap - The sys call used to resize a mapped memory region.

This document was automatically generated by OpenAI and needs review. It might not be accurate and might contain errors. The authors of Tracee recommend that the user reads the "events.go" source file to understand the events and their arguments better.