Skip to content

Commit

Permalink
Improved docs for process memory methods
Browse files Browse the repository at this point in the history
  • Loading branch information
vigna committed Nov 2, 2023
1 parent b4c087e commit 4589591
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,15 @@ impl Process {

/// Returns the memory usage (in bytes).
///
/// This method returns the [size of the resident set](https://en.wikipedia.org/wiki/Resident_set_size),
/// that is, the amount of memory that the process allocated and that is currently mapped in physical RAM.
/// It does not include memory that is swapped out, or, in some operating systems,
/// that has been allocated but never used.
///
/// Thus, it represent exactly the amount of physical RAM that the process is using at the present time,
/// but it might not be a good indicator of the total memory that the process will be using
/// over its lifetime. For that purpose, you can try and use [`virtual_memory`](Process::virtual_memory).
///
/// ```no_run
/// use sysinfo::{Pid, System};
///
Expand All @@ -906,6 +915,18 @@ impl Process {

/// Returns the virtual memory usage (in bytes).
///
/// This method returns the [size of virtual memory](https://en.wikipedia.org/wiki/Virtual_memory),
/// that is, the amount of memory that the process can access, whether it is currently mapped in physical RAM
/// or not. It includes physical RAM, allocated but not used regions, swapped-out regions, and even
/// memory associated with [memory-mapped files](https://en.wikipedia.org/wiki/Memory-mapped_file).
///
/// Depending on the operating system and type of process, this value might be a good indicator
/// of the total memory that the process will be using over its lifetime. However, for example,
/// in the current version of MacOS this value is in the order of the hundreds of
/// gigabytes for every process, and thus not very informative. Moreover, if a process
/// maps into memory a very large file, this value will increase accordingly, even if the
/// process is not actively using the memory.
///
/// ```no_run
/// use sysinfo::{Pid, System};
///
Expand Down

0 comments on commit 4589591

Please sign in to comment.