#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

#5 in #locked

Download history 36/week @ 2024-03-03 58/week @ 2024-03-10 115/week @ 2024-03-17 61/week @ 2024-03-24 102/week @ 2024-03-31 25/week @ 2024-04-07 30/week @ 2024-04-14 32/week @ 2024-04-21 29/week @ 2024-04-28 26/week @ 2024-05-05 27/week @ 2024-05-12 44/week @ 2024-05-19 29/week @ 2024-05-26 37/week @ 2024-06-02 21/week @ 2024-06-09 47/week @ 2024-06-16

141 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

~19KB