Running out of swap space????

Bill Moran wmoran at
Tue Jun 6 14:23:27 UTC 2006

On Tue, 06 Jun 2006 09:13:22 -0500
Paul Schmehl <pauls at> wrote:

> cknipe at wrote:
> > Quoting bob.middaugh at
> > 
> >>> -------------- Original message ----------------------
> >>> From: pauls at
> >>> +pid 37308 (mysqld), uid 88, was killed: out of swap space
> >>> +swap_pager: out of swap space
> >>> +swap_pager_getswapspace(1): failed
> >>
> >> If you kill mysql server, does the swap space free up?  Are there any known
> >> issues between the version of MySQL that you're running and FreeBSD 6.0?
> > 
> > MySQL not having a properly tuned config file for the system it runs on?  It is
> > known to consume vast amounts of resources if not properly configured... 
> > 
> I wrote a one line shell script that runs swapinfo -h and cron'd it to 
> run once an hour.  Each hour the amount of swap space being used has 
> increased by 100 to 200 MB.  Eventually swap is exhausted and the system 
> kills a binary.  (It's not just mysql.  Other things are being killed as 
> well.)

This is typical.  I believe that the process killed is the one swapped out
the longest, or maybe it's random?  Either way, the one killed usually
isn't the one using all the memory.

> What would cause swap to increase steadily like that?  Something not 
> releasing swap when it's no longer needed?

One of two things:
1) You have misconfigured an application to think it has _way_ more memory
   available than it does, so it just keeps using more and more memory,
   because you told it that it was OK to do so.
2) You are running an application with a memory leak.  Meaning: it allocates
   memory, then loses track of said allocation and re-allocates it later.
   Since it lost track, it's no longer using the memory, but can't tell
   the kernel to release the memory for other applications to use either.
   This is a bug in the application, not FreeBSD.

If you provide the full output of top to the list, I'm sure some problem
will jump out for someone on the list.  Wait till the system is close to
having no swap, then do "top > somefile" and paste the file into your

Bill Moran
Collaborative Fusion Inc.

More information about the freebsd-questions mailing list