2 releases
0.0.2 | Oct 11, 2018 |
---|---|
0.0.1 | Oct 6, 2018 |
#542 in Memory management
16KB
329 lines
This library provides a thin wrapper around the memmap
crate in order to make file-backed
mapped memory safe in Rust. Although the crate tries it's best at ensuring safety, this can not
be fully guaranteed.
Safe and Unsafe usage
Since Linux and other Unix-Systems currently do not provide mandatory file locks (Linux does but it's buggy and will be removed in the future), it is not possible to prevent parallel access to a certain file. Therefore file-backed mapped memory is inherently unsafe.
However, if you access a file only through this library and not through the std::fs::File
API, you are safe. This crate uses an advisory lock internally to make sure only one
MappedFile
instance ever exists at the same time for the same file.
Oh, and don't use it on network filesystems, I haven't tested that.
Dependencies
~89–300KB