[kwlug-disc] Debugging for memory use

Chris Irwin chris at chrisirwin.ca
Mon Aug 30 12:13:32 EDT 2010

On Mon, 2010-08-30 at 11:53 -0400, Khalid Baheyeldin wrote:
> On Mon, Aug 30, 2010 at 11:27 AM, Chris Irwin <chris at chrisirwin.ca>
> wrote:

>         Long explanation: I've been having a problem where over time
>         my
>         machine has less and less free memory. After some playing
>         around, it
>         turns out that about 500MB of 'stuff' had been swapped out. 
> Check if a lower vm.swappiness helps?
> http://www.linuxvox.com/2009/10/what-is-the-linux-kernel-parameter-vm-swappiness/

I don't think that would make much of a difference in this case. I was
"using" more memory than I have. Even a low swappiness would have
swapped, just maybe slightly less (I still had ~100MB cache)

>         I have 4GB of ram, and `free -m` showed very little as
>         'cached' (maybe 100MB), so I'm looking at 'actual' memory
>         usage.
>         First thing I did was kill chromium. For a browser, it tends
>         to be
>         rather memory intensive. 
> Because each window (rather each tab) in the browser is a separate
> process. That is one of the design goals for Chromium, to isolate a
> bad plugin (Flash) taking down the entire browser and all its
> windows/tabs.
> So, if you open a lot of tabs, that means lots of processes.

Right, which is why it is the first thing I killed. Turns out that while
it uses more memory than Firefox, it wasn't the cause of my problem. I
really shouldn't have mentioned it :)

>         That only freed up a few hundred MB of
>         memory. My machine, sitting at an empty Gnome desktop was
>         using ~3.2
>         GB doing nothing. 
> This is insane.

I agree.

>         After some detective work I killed nautilus and
>         suddenly had an extra 1 GB of memory available. This has
>         happened
>         twice so far, but the effects are far enough removed from any
>         actual
>         nautilus use that I don't know what caused it.
> Even 2.2 GB with nothing but Gnome is still too high.
> I am using KDE, so can't tell what is normal for Gnome, but looking at
> my laptop now, using the RES field in top: Firefox is the one that
> uses most memory (1.1G, yes many tabs open), then Xorg is 188MB, then
> Amarok is 145MB, and Open Office with one document being edited is
> 104MB. Everything after that is less than 100MB.

I rebooting yesterday. I used the system for a bit, suspended for the
night, resumed here at work, and have this (sorry if it wraps):

$ uptime
 12:03:12 up 12:12,  3 users,  load average: 0.15, 0.43, 0.76

$ free -m
            total       used       free     shared    buffers     cached
Mem:         3825       3331        493          0         81       1480
-/+ buffers/cache:      1770       2054
Swap:        3811          9       3802

This shows that I'm using ~1.7GB with just evolution and a
gnome-terminal open, the rest is disk cache.

According to top, the RES for nautilus is 691MB. Evolution is 260,
everything else is < 100. If I kill nautilus, it auto respawns (it
paints my desktop), but RES is a reasonable 56MB. I'm also down to just
under 1.2GB used, which is reasonable.

$ free -m
            total       used       free     shared    buffers     cached
Mem:         3825       2772       1052          0         83       1512
-/+ buffers/cache:      1175       2649
Swap:        3811          6       3805

>         So, how can I investigate this? Can I install symbols and
>         connect to a
>         running nautilus process with gdb? Also, how do I use gdb? Is
>         there
>         something else that is better suited for debugging memory
>         issues?
> Does Nautilus do something like automatic desktop indexing, or
> something
> like that? That would consume a lot of memory and if there is a bug,
> it can
> be leaking memory too.

No, indexing is not handled by the file manager, but by other solutions
such as tracker/etc. I don't have an indexer enabled anyway.

Maybe it could be thumbnails. If I start browsing around, could nautilus
be hanging on to thumbnails in memory? I suppose I'll have to do a basic
comparison of memory usage.

Chris Irwin <chris at chrisirwin.ca>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://kwlug.org/pipermail/kwlug-disc_kwlug.org/attachments/20100830/22d14309/attachment.bin>

More information about the kwlug-disc mailing list