Pagemon - Tool to Monitor Memory Map of Running Process

Recently,  Colin Ian King from Canonical has developed a new tool called 'pagemon'. It is an ncurses based interactive memory monitoring tool that allows users to browse the memory map of an active Linux process.  Page Table Entries (PTEs) are the basis for the working of this tool.

Pagemon continuously scans the PTEs of a given process and displays the dirty activity in real-time.  It can also identify the type of mapping a memory page belongs to. Due to this, users can easily scan through the memory and easily identify pages of memory that belongs to code, data, stack, heap, anonymous mappings or swapped out pages. The tool is available in Ubuntu Xenial.


In order to install pagemon on Debian based systems, first install the ppa repository "ppa:colin-king/pagemon".

sudo add-apt-repository ppa:colin-king/pagemon
poornima@poornima-Lenovo:~$ sudo add-apt-repository ppa:colin-king/pagemon
[sudo] password for poornima:
Page monitoring tool
More info:
Press [ENTER] to continue or ctrl-c to cancel adding it

gpg: keyring `/tmp/tmpsdek8lba/secring.gpg' created
gpg: keyring `/tmp/tmpsdek8lba/pubring.gpg' created
gpg: requesting key B0F01786 from hkp server
gpg: /tmp/tmpsdek8lba/trustdb.gpg: trustdb created
gpg: key B0F01786: public key "Launchpad PPA for Colin King" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)

Now, update the repository and install pagemon

sudo apt-get update

sudo apt-get install pagemon
poornima@poornima-Lenovo:~$ sudo apt-get install pagemon
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
gcj-4.9-jre-headless gcj-4.9-jre-lib gir1.2-gconf-2.0 libboost-thread1.55.0
libdirac-encoder0 libgcj15 libmediaart-1.0-0 libmircommon3 libts-0.0-0
linux-headers-3.16.0-23 linux-headers-3.16.0-23-generic
linux-image-3.16.0-23-generic linux-image-extra-3.16.0-23-generic
ruby-celluloid ruby-hitimes ruby-timers tsconf
Use 'apt-get autoremove' to remove them.
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 65 not upgraded.
Need to get 16.0 kB of archives.
After this operation, 42.0 kB of additional disk space will be used.
Get:1 wily/main pagemon i386 0.01.06-1~w [16.0 kB]
Fetched 16.0 kB in 0s (25.0 kB/s)
Selecting previously unselected package pagemon.
(Reading database ... 319256 files and directories currently installed.)
Preparing to unpack .../pagemon_0.01.06-1~w_i386.deb ...
Unpacking pagemon (0.01.06-1~w) ...
Processing triggers for man-db (2.7.4-1) ...
Setting up pagemon (0.01.06-1~w) ...

You are now ready to launch pagemon and use it. But remember that you need to always use 'sudo' as it needs to intrude a running process.


Here is the screenshot showing the options available as of now with pagemon.

pagemon help options

In order to monitor a process, we need to pass the process id to pagemon tool.

sudo pagemon -p <process name>  OR

sudo pagemon -p <pid> OR

sudo pagemon -p $(pidof process)    - if you do not know the pid.

The example below shows how to monitor the memory activities of init process using pagemon.

poornima@poornima-Lenovo:~$ sudo pagemon -p init

poornima@poornima-Lenovo:~$ sudo pagemon -p 1

poornima@poornima-Lenovo:~$ sudo pagemon -p $(pidof init)

Page view of 'init' process

Another interesting feature of this tool is that it is also possible to view the memory pages belonging to heap, stack, data, code, anonymous mappings and swapped out pages by hitting the 'enter' key when in the pageview.  Its ability to show memory pages getting swapped out under high memory pressure is quite useful.

Memory view of init process

We can view the VM state by using the -v option with pagemon.  It displays details like the state of the process (running / sleeping), VM size, PTE, Swap, major and minor page faults etc.

sudo pagemon -p <pid> -v

VM state of a process

If you want to increase or decrease the delay (in microseconds) in data refreshes, use the '-d' option. The default is 10,000 microseconds.

For more options, refer the man page of the tool and its source can be cloned from ubuntu kernel page.


Pagemon is useful in tracking page activity of running processes. The developer claims that the code is of early developmental quality but does work quite well if anyone is interested in trying. There could be more features added to it in the coming days. Overall, a cool tool to try out.

3 Comments... add one

  1. Thanks for the write-up. The example has a typo:

    sudo pagemon -p ($pidof init)

    should be:

    sudo pagemon -p $(pidof init)

    The latest version of pagemon allows one to specify the process name too, so one can just use:

    sudo pagemon -p init


Leave a Comment