#page #memory #ram #page-size

no-std page_size

Provides an easy, fast, cross-platform way to retrieve the memory page size

8 releases

Uses old Rust 2015

0.4.2 Dec 20, 2019
0.4.1 Oct 10, 2017
0.4.0 Sep 29, 2017
0.3.0 Sep 25, 2017
0.1.1 Sep 21, 2017

#37 in Operating systems

Download history 3761/week @ 2021-01-12 4208/week @ 2021-01-19 5201/week @ 2021-01-26 6580/week @ 2021-02-02 4875/week @ 2021-02-09 6266/week @ 2021-02-16 7063/week @ 2021-02-23 6273/week @ 2021-03-02 6575/week @ 2021-03-09 6572/week @ 2021-03-16 5682/week @ 2021-03-23 4519/week @ 2021-03-30 5068/week @ 2021-04-06 5442/week @ 2021-04-13 4544/week @ 2021-04-20 4359/week @ 2021-04-27

18,947 downloads per month
Used in 94 crates (24 directly)

MIT/Apache

9KB
127 lines

page_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 and Windows.

Documentation

Linux Status Build status

Introduction

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.

Example

extern crate page_size;

fn main() {
    println!("{}", page_size::get());
}

Platforms

page_size_rs should Work on Windows and any POSIX compatible system (Linux, Mac OSX, etc.).

page_size_rs is continuously tested on:

  • x86_64-unknown-linux-gnu (Linux)
  • i686-unknown-linux-gnu
  • x86_64-unknown-linux-musl (Linux w/ MUSL)
  • i686-unknown-linux-musl
  • x86_64-apple-darwin (Mac OSX)
  • i686-apple-darwin
  • x86_64-pc-windows-msvc (Windows)
  • i686-pc-windows-msvc
  • x86_64-pc-windows-gnu
  • i686-pc-windows-gnu

page_size_rs is continuously cross-compiled for:

  • arm-unknown-linux-gnueabihf
  • aarch64-unknown-linux-gnu
  • mips-unknown-linux-gnu
  • aarch64-unknown-linux-musl
  • i686-linux-android
  • x86_64-linux-android
  • arm-linux-androideabi
  • aarch64-linux-android
  • i386-apple-ios
  • x86_64-apple-ios
  • i686-unknown-freebsd
  • x86_64-unknown-freebsd
  • x86_64-unknown-netbsd
  • asmjs-unknown-emscripten

Dependencies

~60KB