UnixMmap.jl

A Julia package that exposes the Unix mmap interfaces

MIT License

Stars
8
Committers
1

UnixMmap

Documentation Build Status DOI

UnixMmap is an alternative to the Julia standard library's Mmap, with the purpose of exposing the Unix memory-mapping interface.

Installation and usage

Installation and loading is as easy as:

pkg> add UnixMmap

julia> using UnixMmap

A file can be memory mapped (read-only by default) by giving the filename and the Array type (optionally with dimensions to give a shape):

julia> UnixMmap.mmap("arbitrary.dat", Vector{Float64})
192-element Vector{Float64}:
 0.0
 0.0
 0.0
 0.0

julia> UnixMmap.mmap("arbitrary.dat", Matrix{Float64}, (64, 3))
64×3 Matrix{Float64}:
 0.0  0.0  0.0
 0.0  0.0  0.0
 0.0  0.0  0.0
 0.0  0.0  0.0

while an anonymous memory map can be created by instead specifying the Array type and dimensions:

julia> UnixMmap.mmap(Matrix{Float64}, (128, 3))
128×3 Matrix{Float64}:
 0.0  0.0  0.0
 0.0  0.0  0.0
 0.0  0.0  0.0
 0.0  0.0  0.0