Skip site navigation (1) Skip section navigation (2)

Re: Postgres filling up hard drive with swap files

From: Bill Moran <wmoran(at)potentialtech(dot)com>
To: Joe Lester <joe_lester(at)sweetwater(dot)com>
Cc: pgsql-general(at)postgresql(dot)org, alvherre(at)dcc(dot)uchile(dot)cl
Subject: Re: Postgres filling up hard drive with swap files
Date: 2004-08-20 17:02:18
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
Joe Lester <joe_lester(at)sweetwater(dot)com> wrote:

> Thanks for the response!
> > Maybe you said this before, but I didn't follow the previous thread.
> > What do you mean by swap files?
> By swap files I mean the files that contain the memory that the OS is 
> maintaining on the hard disk, after physical RAM has overflowed.
> > Where are those files located?
> I can see the swap files and watch them grow over time. They are 
> located on my Mac OS 10.3.2 eMac at /var/vm/.
> > Can you show a listing of them?
> Right now there are not that many since I just restarted the server 
> recently. But already, they total 3 GB.
> officelink:/var/vm root# ls -lh
> drwx--x--x  14 root  wheel       476B 17 Feb  2004 app_profile
> -rw------T   1 root  wheel        64M 31 Jul 09:10 swapfile0
> -rw------T   1 root  wheel        64M 31 Jul 15:13 swapfile1
> -rw------T   1 root  wheel       128M 31 Jul 16:08 swapfile2
> -rw------T   1 root  wheel       256M  3 Aug 13:20 swapfile3
> -rw------T   1 root  wheel       512M 18 Aug 14:29 swapfile4
> -rw------T   1 root  wheel       512M 18 Aug 16:24 swapfile5
> -rw------T   1 root  wheel       512M 18 Aug 23:30 swapfile6
> -rw------T   1 root  wheel       512M 19 Aug 12:59 swapfile7
> -rw------T   1 root  wheel       512M 20 Aug 09:56 swapfile8
> > I assume, of course, that your data proper does not grow linearly with
> > those "swap files," does it?
> The total amount of disk space consumed by the swap files vastly 
> exceeds the size of my postgres data directory, if that's what you're 
> asking, which is about 300 MB or so.

How many Postgres processes are running?  Does this number increase with
the memory usage.

Simple fact of the matter is that you have apparently found a memory
leak.  How Mac OS X deals with swapping is (more or less) unimportant.

I'm wondering, however, if you have a connection leak instead.  i.e.
is it possible that your client application is opening a whole bunch
of connections and never closing them?  You did show that you have
a max # of connection of 200.  That's pretty high, unless you've got
a lot of RAM in that machine.

A more accurate description of the problem would be:
How many connections are actually open?
How much memory is actually in use by Postgres processes?  (The amount of
swap in use is unimportant to the Postgres folks, it's an OS thing)

Bill Moran
Potential Technologies

In response to

pgsql-general by date

Next:From: Peter HaworthDate: 2004-08-20 17:23:22
Subject: Re: How to setup default value "0000-00-00" for "date"
Previous:From: Alvaro HerreraDate: 2004-08-20 16:57:29
Subject: Re: Postgres filling up hard drive with swap files

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group