3

Nautilus is taking up 450 MiB according to System Monitor (Ubuntu 10.04).

$pmap <PID of Nautilus>
...
total          1578276K

Is pmap reporting 1.5 GiB of memory here? I'm trying to find out what's taking up the 450 MiB so I can deduce what I'm doing wrong, or where the problem lies.

1 Answer 1

3

There's no simple notion of how much memory is used by a program.

The output of pmap describes all the virtual memory that's mapped by a process. Mapped means that the process can access that data through a pointer, without issuing any further command to load data or request access. Mapped virtual memory isn't always in RAM: it can be swapped out, and it can be in a file. For example, all the shared libraries that are used by a program are mapped in each process that uses them, but (for the most part) only one copy is kept in RAM for the whole system, and that copy need not be fully loaded in memory (parts that are required will be loaded from the disk file on when needed). The 1.5GB figure includes all of the process's code, static data, shared memory and own data. It's not a very meaningful figure.

pmap is a simple reformatting of /proc/$pid/maps. Understanding Linux /proc/id/maps explains what the columns mean.

The 450MB figure is (I think) the process's resident set, that is, the non-shared memory that is currently in RAM. This includes both data that belongs only to the process (and which may get swapped out), and files that the process has opened for writing (disk buffers, which may be evicted to be reloaded later from the file).

You won't easily be able to break down the 450MB memory further. This is a job for the program's author, with debugging tools.

4
  • Can I pmap or a similar command to see whats in the process's resident set? I dont think the swaps being used (swapoff -a leaves the 450 MiB in System Monitor unchanged...)
    – propaganda
    Jan 15, 2012 at 19:59
  • @propaganda It'll be moslty what doesn't have a file in the pmap output. You can't analyse further without looking at the program's source code and examining various variables with a debugger. Jan 15, 2012 at 20:03
  • perhaps relevant is that I often get the error "firefox is already running" after closing all open windows of firefox, waiting and trying to start the browser (which I solve by killing the running firefoxbin)
    – propaganda
    Jan 15, 2012 at 22:13
  • @propaganda I don't see the connection. If you're sure you don't have a hidden Firefox window, that would be a Firefox bug. Jan 15, 2012 at 22:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .