Skip to main content

aligned_vmem/
page.rs

1/// The minimum page size this crate assumes for decommit/recommit granularity:
2/// 4 KiB, the smallest unit both `mmap` and `VirtualAlloc` will commit/decommit
3/// on the platforms this crate targets.
4///
5/// Decommit/recommit offsets must be multiples of the runtime [`page_size()`](crate::page_size::page_size);
6/// this constant is only the guaranteed lower bound. `page_size()` may be larger
7/// (e.g. 16 KiB on Apple Silicon macOS), so callers computing decommit offsets
8/// must round to `page_size()`, not `PAGE`.
9///
10/// # Naming
11///
12/// This constant was named `PAGE` in the 0.1.0 release. The name is misleading
13/// because it is not the actual page size on all platforms (e.g., 16 KiB on Apple
14/// Silicon macOS, 64 KiB on some Linux configurations). For new code, prefer
15/// [`MIN_PAGE`](crate::min_page::MIN_PAGE) instead, which more accurately describes what this constant
16/// represents: the *minimum* granularity the crate assumes, not the platform's
17/// page size.
18pub const PAGE: usize = 1 << 12;