Memory-mapped file
lastmod 2025-11-12created 2017-02-212 edits
A memory-mapped file (Memory mapped file, MMF) is one of the ways an operating system handles files. It can be used for anything the operating system treats as a file, such as physical disk files, devices, and shared memory objects. A memory-mapped file maps the file into the process's virtual memory address space, and file reads and writes are replaced by direct access to virtual memory addresses.
Compared with the basic file I/O API, it lets you access file contents at lower cost, and it is simpler to use because the operating system automatically handles data transfer between memory and the file. When different processes access the same file through memory-mapped files, it can also be used like shared memory.