Crate system_memory

source ·
Expand description

A small crate that resolves the total system memory of the host. This is useful for many projects that may behave differently depending on how much memory the host system has and how much is available.

Be aware of the potential for data races when using this code – since the amount of available system memory may ( and likely will) change between calls, repeated use of the function even on the same thread cannot be expected to return the same values, nor will available necessarily return values consistent with used, since the value may change between calls.

Modules§

  • linuxLinux
    Linux specific implementation.

Functions§

  • availableWindows or Linux or macOS or iOS
    Get the number of bytes of available physical memory on this host.
  • totalWindows or Linux or macOS or iOS
    Get the total number of bytes of physical memory on this host.
  • usedWindows or Linux or macOS or iOS
    Get the number of bytes of physical memory currently in use.