pub fn monero(current_size_bytes: usize) -> NonZeroUsize
Expand description
Memory map resize closely matching monerod
.
§Method
This function mostly matches monerod
’s current resize implementation1,
and will increase current_size_bytes
by 1 << 30
2 exactly then
rounded to the nearest multiple of the OS page size.
// The value this function will increment by
// (assuming page multiple of 4096).
const N: usize = 1_073_741_824;
// 0 returns the minimum value.
assert_eq!(monero(0).get(), N);
// Rounds up to nearest OS page size.
assert_eq!(monero(1).get(), N + PAGE_SIZE.get());
§Panics
This function will panic if adding onto current_size_bytes
overflows usize::MAX
.
ⓘ
// Ridiculous large numbers panic.
monero(usize::MAX);