X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5F3819DCAE0 for ; Thu, 8 Dec 2005 10:00:07 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31578-03 for ; Thu, 8 Dec 2005 10:00:10 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.198]) by postgresql.org (Postfix) with ESMTP id 9F1699DCBA7 for ; Thu, 8 Dec 2005 10:00:04 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 9so610591nzo for ; Thu, 08 Dec 2005 06:00:06 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=DEbmxml9cNTB3g9AGBMlSNvpMlrhJ5KBkn48BlbWtseHnJQD8+m+wRGE2sRwNOsz9z69/mgaTtRzlPpQ1Dq3cJ4s0kv7SG6uT8LSkZxtMsHGgMh/Sa+OGExjZ8oofdiCmXa5C3c7dFV0Z4L26TYKAKaGjNuQvJMjAnP331jHv2s= Received: by 10.64.185.2 with SMTP id i2mr2772806qbf; Thu, 08 Dec 2005 06:00:06 -0800 (PST) Received: by 10.65.235.2 with HTTP; Thu, 8 Dec 2005 06:00:06 -0800 (PST) Message-ID: Date: Thu, 8 Dec 2005 14:00:06 +0000 From: Mike Rylander To: Tom Lane Subject: Re: Memory Leakage Problem Cc: pgsql general In-Reply-To: <6353.1134016733@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <1133891282.11803.7.camel@state.g2switchworks.com> <1133991204.11803.43.camel@state.g2switchworks.com> <6353.1134016733@sss.pgh.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/440 X-Sequence-Number: 88003 On 12/8/05, Tom Lane wrote: > Mike Rylander writes: > > To cut to the chase, here are > > some numbers for everyone to digest: > > total gnu ps resident size > > # ps ax -o rss|perl -e '$x +=3D $_ for (<>);print "$x\n";' > > 5810492 > > total gnu ps virual size > > # ps ax -o vsz|perl -e '$x +=3D $_ for (<>);print "$x\n";' > > 10585400 > > total gnu ps "if all pages were dirtied and swapped" size > > # ps ax -o size|perl -e '$x +=3D $_ for (<>);print "$x\n";' > > 1970952 > > I wouldn't put any faith in those numbers at all, because you'll be > counting the PG shared memory multiple times. > > On the Linux versions I've used lately, ps and top report a process' > memory size as including all its private memory, plus all the pages > of shared memory that it has touched since it started. So if you run > say a seqscan over a large table in a freshly-started backend, the > reported memory usage will ramp up from a couple meg to the size of > your shared_buffer arena plus a couple meg --- but in reality the > space used by the process is staying constant at a couple meg. Right, I can definitely see that happening. Some backends are upwards of 200M, some are just a few since they haven't been touched yet. > > Now, multiply that effect by N backends doing this at once, and you'll > have a very skewed view of what's happening in your system. Absolutely ... > > I'd trust the totals reported by free and dstat a lot more than summing > per-process numbers from ps or top. > And there's the part that's confusing me: the numbers for used memory produced by free and dstat, after subtracting the buffers/cache amounts, are /larger/ than those that ps and top report. (top says the same thing as ps, on the whole.) > > Now, I'm not blaming Pg for the apparent discrepancy in calculated vs. > > reported-by-free memory usage, but I only noticed this after upgrading > > to 8.1. > > I don't know of any reason to think that 8.1 would act differently from > older PG versions in this respect. > Neither can I, which is why I don't blame it. ;) I'm just reporting when/where I noticed the issue. > regards, tom lane > -- Mike Rylander mrylander@gmail.com GPLS -- PINES Development Database Developer http://open-ils.org