Memory-mapped file

[6][7] Use of GMMF requires declaring the maximum to which the file size can grow, but no unused space is wasted.

Accessing memory mapped files is faster than using direct read and write operations for two reasons.

Firstly, a system call is orders of magnitude slower than a simple change to a program's local memory.

An even smaller amount of addressable space is available to individual programs—typically in the range of 2 to 3 GiB, depending on the operating system kernel.

mmap also tends to be less scalable than standard means of file I/O, since many operating systems, including Linux, have a cap on the number of cores handling page faults.

Extremely fast devices, such as modern NVM Express SSDs, are capable of making the overhead a real concern.

[12] I/O errors on the underlying file (e.g. its removable drive is unplugged or optical media is ejected, disk full when writing, etc.)

while accessing its mapped memory are reported to the application as the SIGSEGV/SIGBUS signals on POSIX, and the EXECUTE_IN_PAGE_ERROR structured exception on Windows.

Most modern operating systems or runtime environments support some form of memory-mapped file access.

The Microsoft Windows operating systems also support a group of API functions for this purpose, such as CreateFileMapping().

[21] Ruby has a gem (library) called Mmap, which implements memory-mapped file objects.

[27][28] PHP supported memory-mapping techniques in a number of native file access functions such as file_get_contents() but has removed this in 5.3 (see revision log).

For the R programming language there exists a library on CRAN called bigmemory which uses the Boost library and provides memory-mapped backed arrays directly in R. The package ff offers memory-mapped vectors, matrices, arrays and data frames.

Support can be loaded from 'data/jmf' J's Jdb and JD database engines use memory-mapped files for column stores.

The Julia programming language has support for I/O of memory-mapped binary files through the Mmap module within the Standard Library.