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

no-std lockedbox

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

3 releases

0.1.2 Jul 14, 2024
0.1.1 Sep 12, 2023
0.1.0 Sep 12, 2023

#328 in Memory management

Download history 99/week @ 2024-04-01 21/week @ 2024-04-08 32/week @ 2024-04-15 29/week @ 2024-04-22 30/week @ 2024-04-29 25/week @ 2024-05-06 30/week @ 2024-05-13 43/week @ 2024-05-20 28/week @ 2024-05-27 35/week @ 2024-06-03 27/week @ 2024-06-10 45/week @ 2024-06-17 34/week @ 2024-06-24 1/week @ 2024-07-01 99/week @ 2024-07-08 72/week @ 2024-07-15

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

MIT/Apache

12KB
89 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