Memory leak and swapfile

Matthew Seaman m.seaman at infracaninophile.co.uk
Sat Nov 27 22:06:21 UTC 2010


On 26/11/2010 18:24, Jack Raats wrote:
> It looks like that there may be a memory leak of my swap space with one
> of the processes that is running.
> Big question: How can I determine which process is responsible.
> 
> Any suggestions?

Look for a process with a really big SIZE in top(1) ?

Look for pages being mapped to swap via 'systat -vmstat 1'  Any activity
of the Swap Pager is a bad sign.

It's not so much 'swap space' as some process or processes using up
memory in general: when more memory has been allocated by processes than
will fit into RAM simultaneously, then you'll start getting pages mapped
to swap.  This is not intrinsically a bad thing: a one-time swap out of
a load of otherwise idle memory pages will clear space for more actively
used stuff.  It's generally very bad for performance if processes are
getting continually swapped in and out -- disk IO is pretty slow
compared to RAM.  Use eg. 'systat -vmstat 1' to monitor
swap activity.

It's not necessarily *one* process getting too big.  Processes that fork
multiple copies of themselves (like apache) can fill up RAM by spawning
too many copies of themselves.  In fact, it's a well known apache tuning
trick to limit the maximum number of apache child processes to what will
fit into RAM at one time -- swapping makes a far bigger impact on
performance than queueing up web requests until there's a free worker
process to service them.

	Cheers,

	Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.                   7 Priory Courtyard
                                                  Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey     Ramsgate
JID: matthew at infracaninophile.co.uk               Kent, CT11 9PW

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 267 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20101127/86de4ebb/signature.pgp


More information about the freebsd-questions mailing list