Search code examples
c++linuxposixmmapmemory-mapped-files

Access non-persisted memory-mapped files


I cannot find a library for non-persisted memory-mapped files in Linux for C++. I searched for a while to find any library but there is nothing is there any reason why this does not exist in Linux and what would work instead of non-persisted memory-mapped files to share memory between two programs. Thanks in advance.


Solution

  • There is no need for a library. This is directly supported by the POSIX standard.

    Use MAP_ANONYMOUS on mmap:

    The mapping is not backed by any file; its contents are initialized to zero.