Skip to main content

ps_mem

A utility to accurately report the core memory usage for a program

Yes the name is a bit weird. coremem would be more appropriate, but for backwards compatible reasons the ps_mem name remains.

Install:

pip install ps_mem is supported, or rpm and deb packages are available for most distros. Also the ps_mem.py script can be run directly.

Usage:

ps_mem [-h|--help] [-p PID,...] [-s|--split-args] [-t|--total] [-w N]
       [-d|--discriminate-by-pid] [-S|--swap]

Example output:

 Private  +   Shared  =  RAM used       Program

 34.6 MiB +   1.0 MiB =  35.7 MiB       gnome-terminal
139.8 MiB +   2.3 MiB = 142.1 MiB       firefox
291.8 MiB +   2.5 MiB = 294.3 MiB       gnome-shell
272.2 MiB +  43.9 MiB = 316.1 MiB       chrome (12)
913.9 MiB +   3.2 MiB = 917.1 MiB       thunderbird
---------------------------------
                          1.9 GiB
=================================

The [-p PID,...] option allows filtering the results. For example to restrict output to the current $USER you could:

sudo ps_mem -p $(pgrep -d, -u $USER)

or to summarize the total RAM usage per user you could:

for i in $(ps -e -o user= | sort | uniq); do
  printf '%-20s%10s\n' $i $(sudo ps_mem --total -p $(pgrep -d, -u $i))
done

Release files for ps-mem 3.14

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ps-mem 3.14
File Size Uploaded
ps_mem-3.14.tar.gz 19.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ps-mem 3.14
File Interpreter ABI Platform
ps_mem-3.14-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 38.7 kB

Release files / ps_mem-3.14.tar.gz

Download URL ps_mem-3.14.tar.gz
Size 19.5 kB
Tags Source
SHA-256 checksum
How to use checksums
14de44f747effbaec620e1cc783a6ab6bd78b2639c0dcfaa132561f9efef47ca
BLAKE2b-256 checksum
How to use checksums
1d4426189e96f535a3479e1a4b858da3fb75ad25f82e9ab3323e032deab28420
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.3

Release files / ps_mem-3.14-py2.py3-none-any.whl

Download URL ps_mem-3.14-py2.py3-none-any.whl
Size 19.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
43f5cd9f173fcf20d035dd44c02dca828c914dbfb4f202b1229aa0675ff25139
BLAKE2b-256 checksum
How to use checksums
07e9c843b735b12d57eb77bd563a11c530e103df5fd2bbbbb9974cde7d98d515
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.3

Release history Release notifications | RSS feed

This release

3.14 This release

2 release files

3.12

1 release file

3.6

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page