[Durham] Swap fills up then out of memory errors

Oliver Burnett-Hall olly at burnett-hall.co.uk
Sat Feb 18 00:18:46 UTC 2012

On 17 February 2012 22:40, Dougie Nisbet <dougie at highmoor.co.uk> wrote:
> What appears to be happening is that the amount of swap being allocated
> gradually creeps up, usually over several days, as observed using something
> like gnome-system-monitor.

That's definitely the symptom of a memory leak.

> I think I understand the principle that it's not
> necessarily a bad thing that all swap becomes allocated, while memory used
> remains low, as idle programs can be swapped out even when memory is
> available

You've got that backwards.  It's normal if you've got 90+% memory
usage, but you want to keep some swap space free.

The fundamentals here is that memory (RAM) is fast and swap (hard
disk) is slow.  If your applications aren't using the available
memory, then the OS will use the spare capacity for caching recently
used files, or readahead on files it thinks it may be accessed soon.
There's no point using swap for this as it's very unlikely to be much
faster than reading the files straight from disk.  [If you've got swap
on flash then this won't be true, but I'm assuming that you don't].

> But something is clearly not right. Occasionally, and I suspect
> coinciding with the amount of swap used hitting 100%, the system grinds to a
> halt, and eventually recovers some speed or reboots.

Swap is used if you don't have enough system memory available.  It's
called swap as the CPU can't use it directly; instead the contents of
an area of the RAM and the swap space are swapped so that the CPU can
then access the data.  If both memory and swap are nearly full, this
happens constantly and the entire system grinds to a halt you'll be
able to hear the disk thrashing as data is read/written from/to disk
in small chunks.

> My suspicion is that it's flickr_upload (although some old exaile related
> posts mention a memory leak - but the symptoms don't match mine). I suppose
> the next logical step would be to run gnome-system-monitor, then repeatedly
> run test flickr_upload instances on the command line, and see if it
> corresponds to an increase in swap allocation.

Neither flickr* or exaile* are mentioned in the log file you posted.

Like Richard said, there's nothing particularly excessive showing --
but this depends on how much memory and swap you've got.
x-www-browser is using 225MB and various XFCE processes are using a
couple of hundred megabytes.  This isn't a huge amount, but if you've
only got 256MB of RAM and a similar amount of swap that would be
enough to cause problems.

- olly

More information about the Durham mailing list