Introduction
Themem package provides cross-platform access to memory statistics, including virtual (RAM) and swap memory information. It abstracts platform-specific differences and provides a consistent API across Linux, Windows, macOS, and BSD systems.
Key Features
Virtual Memory Stats
Get detailed RAM usage statistics including total, available, used memory and platform-specific metrics
Swap Memory Stats
Access swap space information including usage, paging activity, and page fault statistics
Platform Extensions
Linux and Windows specific extended memory information beyond standard metrics
Cross-Platform
Consistent API across Linux, Windows, macOS, FreeBSD, OpenBSD, and Solaris
Package Import
Main Functions
VirtualMemory
Retrieves current virtual memory (RAM) statistics.*VirtualMemoryStat containing detailed memory statistics
Example:
SwapMemory
Retrieves current swap memory statistics.*SwapMemoryStat containing swap usage and paging statistics
Example:
SwapDevices
Retrieves information about individual swap devices (Linux only).*SwapDevice with name and usage per swap device
Data Types
- VirtualMemoryStat - RAM usage statistics
- SwapMemoryStat - Swap space statistics
- SwapDevice - Individual swap device information
Platform Support
| Platform | VirtualMemory | SwapMemory | SwapDevices | Extended Stats |
|---|---|---|---|---|
| Linux | ✓ | ✓ | ✓ | ✓ |
| Windows | ✓ | ✓ | ✗ | ✓ |
| macOS | ✓ | ✓ | ✗ | ✗ |
| FreeBSD | ✓ | ✓ | ✗ | ✗ |
| OpenBSD | ✓ | ✓ | ✗ | ✗ |
| Solaris | ✓ | ✓ | ✗ | ✗ |
Related Packages
CPU Package
CPU usage and information statistics
Disk Package
Disk usage and I/O statistics