0.6.0 - This version may not be safe as it has not been updated for a long time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform
Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.
MIT - MIT Licensepage_size_rs is a Rust crate that provides an easy, fast, cross-platform way to retrieve the memory page size of the current system. It supports any POSIX-compliant system, Windows, and WebAssembly.
Modern hardware and software tend to load data into RAM (and transfer data from RAM to disk) in discrete chunk called pages. This crate provides a helper method to retrieve the size in bytes of these pages. Since the page size should not change during execution, page_size_rs will cache the result after it has been called once.
To make this crate useful for writing memory allocators, it does not require (but can use) the Rust standard library.
Since Windows addresses sometimes have to correspond with an allocation granularity that does not always match the size of the page, I have included a method to retrieve that as well.
extern crate page_size;
fn main() {
println!("{}", page_size::get());
}page_size_rs should Work on Windows, any POSIX compatible system (Linux, Mac OSX, etc.), and WebAssembly.
page_size_rs is continuously tested on:
x86_64-unknown-linux-gnu (Linux)i686-unknown-linux-gnux86_64-unknown-linux-musl (Linux w/ MUSL)i686-unknown-linux-muslx86_64-apple-darwin (Mac OSX)i686-apple-darwinx86_64-pc-windows-msvc (Windows)i686-pc-windows-msvcx86_64-pc-windows-gnui686-pc-windows-gnupage_size_rs is continuously cross-compiled for:
arm-unknown-linux-gnueabihfaarch64-unknown-linux-gnumips-unknown-linux-gnuaarch64-unknown-linux-musli686-linux-androidx86_64-linux-androidarm-linux-androideabiaarch64-linux-androidi386-apple-iosx86_64-apple-iosi686-unknown-freebsdx86_64-unknown-freebsdx86_64-unknown-netbsdasmjs-unknown-emscriptenwasm32-wasiwasm32-unknown-unknown