#memory #mlock #disk #paging #content #locked #locking

no-std lockedbox

A Box-like type that prevents paging its contents to disk

2 releases

0.1.1 Sep 12, 2023
0.1.0 Sep 12, 2023

#301 in Memory management

Download history 2/week @ 2024-01-05 4/week @ 2024-01-12 8/week @ 2024-01-26 57/week @ 2024-02-02 69/week @ 2024-02-09 48/week @ 2024-02-16 67/week @ 2024-02-23 49/week @ 2024-03-01 55/week @ 2024-03-08 117/week @ 2024-03-15 62/week @ 2024-03-22 86/week @ 2024-03-29 44/week @ 2024-04-05 28/week @ 2024-04-12 20/week @ 2024-04-19

189 downloads per month
Used in 5 crates (via bonsaidb-local)

MIT/Apache

12KB
86 lines

LockedBox

A crate providing an mlock-locked Box<T>, preventing the contents of its memory from being paged to disk.

This crate prevents potential accidental unlocking of memory by ensuring the memory allocated by LockedBox<T> is always a multiple of the operating system's page size. Because mlock/munlock operate on pages of memory, this guarantees that each LockedBox<T> is guaranteed to have its own lock status.

LockedBox<T> is a thin, safe abstraction built atop memsec.

Alternatives

Open-source Licenses

This project, like all projects from Khonsu Labs, is open-source. This repository is available under the MIT License or the Apache License 2.0.

To learn more about contributing, please see CONTRIBUTING.md.

Dependencies