smem(8) — Linux manual page


SMEM(8)                                                              SMEM(8)

NAME         top

       smem - Report memory usage with shared memory divided proportionally.

SYNOPSIS         top

       smem [options]

DESCRIPTION         top

       smem reports physical memory usage, taking shared memory pages into
       account.  Unshared memory is reported as the USS (Unique Set Size).
       Shared memory is divided evenly among the processes sharing that
       memory.  The unshared memory (USS) plus a process's proportion of
       shared memory is reported as the PSS (Proportional Set Size).  The
       USS and PSS only include physical memory usage.  They do not include
       memory that has been swapped out to disk.

       Memory can be reported by process, by user, by mapping, or
       systemwide.  Both text mode and graphical output are available.

OPTIONS         top

       -h, --help
              Show help.

       By default, smem will pull most of the data it needs from the /proc
       filesystem of the system it is running on.  The --source option lets
       you used a tarred set of /proc data saved earlier, possibly on a
       different machine.  The --kernel and --realmem options let you
       specify a couple things that smem cannot discover on its own.

       -K KERNEL, --kernel=KERNEL
              Path to an uncompressed kernel image.  This lets smem include
              the size of the kernel's code and statically allocated data in
              the systemwide (-w) output.  (To obtain an uncompressed image
              of a kernel on disk, you may need to build the kernel
              yourself, then locate file vmlinux in the source tree.)

       -R REALMEM, --realmem=REALMEM
              Amount of physical RAM.  This lets smem detect the amount of
              memory used by firmware/hardware in the systemwide (-w)
              output.  If provided, it will also be used as the total memory
              size to base percentages on.  Example: --realmem=1024M

       -S SOURCE, --source=SOURCE
              /proc data source.  This lets you specify an alternate source
              of the /proc data.  For example, you can capture data from an
              embedded system using smemcap, and parse the data later on a
              different machine.  If the --source option is not included,
              smem reports memory usage on the running system.

       If none of the following options are included, smem reports memory
       usage by process.

       -m, --mappings
              Report memory usage by mapping.

       -u, --users
              Report memory usage by user.

       -w, --system
              Report systemwide memory usage summary.

       If none of these options are included, memory usage is reported for
       all processes, users, or mappings.  (Note: If you are running as a
       non-root user, and if you are not using the --source options, then
       you will only see data from processes whose /proc/ information you
       have access to.)

       -M MAPFILTER, --mapfilter=MAPFILTER
              Mapping filter regular expression.

       -P PROCESSFILTER, --processfilter=PROCESSFILTER
              Process filter regular expression.

       -U USERFILTER, --userfilter=USERFILTER
              User filter regular expression.

       -a, --autosize
              Size columns to fit terminal size.

       -c COLUMNS, --columns=COLUMNS
              Columns to show.

       -H, --no-header
              Disable header line.

       -k, --abbreviate
              Show unit suffixes.

       -n, --numeric
              Show numeric user IDs instead of usernames.

       -p, --percent
              Show percentages.

       -r, --reverse
              Reverse sort.

       -s SORT, --sort=SORT
              Field to sort on.

       -t, --totals
              Show totals.

       These options specify graphical output styles.

              Show bar graph.

              Show pie graph.

REQUIREMENTS         top

       smem requires:

       ·  Linux kernel providing 'Pss' metric in /proc/<pid>/smaps
          (generally 2.6.27 or newer).

       ·  Python 2.x (at least 2.4 or so).

       ·  The matplotlib library (only if you want to generate graphical

EMBEDDED USAGE         top

       To capture memory statistics on resource-constrained systems, the the
       smem source includes a utility named smemcap.  smemcap captures all
       /proc entries required by smem and outputs them as an uncompressed
       .tar file to STDOUT.  smem can analyze the output using the --source
       option.  smemcap is small and does not require Python.

       To use smemcap:

       1. Obtain the smem source at

       2. Compile smemcap.c for your target system.

       3. Run smemcap on the target system and save the output:
          smemcap > memorycapture.tar

       4. Copy the output to another machine and run smem on it:
          smem -S memorycapture.tar

FILES         top






RESOURCES         top

       Main Web Site:

       Source code repository:

       Mailing list:

SEE ALSO         top

       free(1), pmap(1), proc(5), ps(1), top(1), vmstat(8)

COPYING         top

       Copyright (C) 2008-2009 Matt Mackall.  Free use of this software is
       granted under the terms of the GNU General Public License version 2
       or later.

AUTHOR         top

       smem was written by Matt Mackall.

COLOPHON         top

       This page is part of the smem (Report memory usage with shared memory
       divided proportionally) project.  Information about the project can
       be found at ⟨⟩.  If you have a bug
       report for this manual page, send it to  This page
       was obtained from the project's upstream Mercurial repository
       ⟨⟩ on 2020-07-14.  (At that time, the
       date of the most recent commit that was found in the repository was
       2015-05-15.)  If you discover any rendering problems in this HTML
       version of the page, or you believe there is a better or more up-to-
       date source for the page, or you have corrections or improvements to
       the information in this COLOPHON (which is not part of the original
       manual page), send a mail to

                                 03/15/2010                          SMEM(8)