pub struct SystemRss { /* private fields */ }Expand description
Live reader of the current process’s swappable memory footprint.
The reading counts anonymous and private copy-on-write pages, shared-memory pages (tmpfs, memfd, POSIX shm) and, where the platform reports them, pages already swapped out or compressed. Clean file-backed pages — memory-mapped immutable files, executable text, page cache faulted in by reads — are excluded: the kernel drops and refaults them from their file, so they can never cause swap. Plain resident-set size counts them, which lets a process that only maps a large file look like it is exhausting memory.
| Platform | Measurement |
|---|---|
| Linux, Android | RssAnon + RssShmem + VmSwap from /proc/self/status |
| macOS, iOS | ri_phys_footprint from proc_pid_rusage |
| Windows | private commit charge (PrivateUsage) |
| other | resident-set size |
Every read is a handful of system calls on a buffer reused across reads, cheap enough for once-per-second sampling.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for SystemRss
impl Forget for SystemRss
impl Move for SystemRss
impl RefUnwindSafe for SystemRss
impl Send for SystemRss
impl Sync for SystemRss
impl Unpin for SystemRss
impl UnsafeUnpin for SystemRss
impl UnwindSafe for SystemRss
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more