remap#

Resize an existing mapping in place.

Synopsis#

remap $map, $new_size;

Arguments#

  • $lvalue — a currently mapped scalar.

  • $new_size — new length in bytes. Must be greater than zero.

When it applies#

remap is Linux-specific. It wraps mremap(2) with MREMAP_MAYMOVE, so the scalar may end up pointing to a different virtual address after the call.

  • For a file-backed mapping, the underlying file must be large enough to cover $new_size, or accessing the extra pages will produce a bus fault.

  • Anonymous shared mappings cannot be remapped.

Use with caution on production data.

Differences from upstream#

Fully compatible with upstream File::Map 0.71.

See also#

  • map_file — pick the right size up front if you can.

  • unmap — drop the mapping entirely instead of resizing.