In a Unix-like system, your program address space consists of one or more areas of virtual memory, each of which is displayed by the OS in physical memory, in a file, or nothing at all.
The heap, generally speaking, is one specific area of ββmemory created by the C runtime environment and managed by malloc (which, in turn, uses the brk and sbrk system calls for growth and compression).
mmap is a way to create new memory regions independently of malloc (and therefore independent of the heap). munmap is just its reverse, it frees up these areas.
source share