folly::MemoryMapping

Maps files in memory (read-only).

Synopsis

Declared in <folly/system/MemoryMapping.h>

class MemoryMapping;

Types

NameDescription
LockFlags Flags controlling how pages are locked into memory.
Options Map a portion of the file indicated by filename in memory, causing SIGABRT on error.

Enums

NameDescription
AnonymousType Selector tag type for the anonymous-mapping constructor.
LockMode Lock the pages in memory? TRY_LOCK = try to lock, log warning if permission denied MUST_LOCK = lock, fail assertion if permission denied.

Member Functions

NameDescription
MemoryMapping [constructor]Constructors
~MemoryMapping [destructor]Destroys the mapping, unmapping the memory.
operator= Assignment operators
advise advise overloads
asRange A bitwise cast of the mapped bytes as range of values. Only intended for use with POD or in-place usable types.
asWritableRange A bitwise cast of the mapped bytes as range of mutable values. Only intended for use with POD or in-place usable types.
data Return the memory area where the file was mapped. Deprecated; use range() instead.
fd Returns the file descriptor backing this mapping.
hintLinearScan Hint that these pages will be scanned linearly. madvise(MADV_SEQUENTIAL)
mlock Lock the pages in memory
mlocked Reports whether the mapping is currently locked in memory.
munlock Unlock the pages. If dontneed is true, the kernel is instructed to release these pages (per madvise(MADV_DONTNEED)).
range A range of bytes mapped by this mapping.
swap Swaps the contents of this mapping with another.
writableRange A range of mutable bytes mapped by this mapping.

Static Member Functions

NameDescription
writable Options to emulate the old WritableMemoryMapping: readable and writable, allow growing the file if mapping past EOF.

Non-Member Functions

NameDescription
swapSwaps the contents of two memory mappings.