From: Bruce Momjian <pgman@candle.pha.pa.us>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: jody brownell <jody.brownell@Q1Labs.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Postgres consuming way too much memory???
Date: Thu, 15 Jun 2006 13:17:46 -0400 (EDT)
Message-ID: <200606151717.k5FHHk901846@candle.pha.pa.us> (raw)
In-Reply-To: <28419.1150386248@sss.pgh.pa.us>
Added to TODO:
> o Fix memory leak from exceptions
>
> http://archives.postgresql.org/pgsql-performance/2006-06/msg0$
---------------------------------------------------------------------------
Tom Lane wrote:
> "jody brownell" <jody.brownell@Q1Labs.com> writes:
> > BEGIN
> > INSERT into attacker_target_link (attacker_id, target_id) values (p_attacker, v_target);
> > v_returns_size := v_returns_size + 1;
> > v_returns[v_returns_size] := v_target;
>
> > EXCEPTION WHEN unique_violation THEN
> > -- do nothing... app cache may be out of date.
> > END;
>
> Hmm. There is a known problem that plpgsql leaks some memory when
> catching an exception:
> http://archives.postgresql.org/pgsql-hackers/2006-02/msg00885.php
>
> So if your problem case involves a whole lot of duplicates then that
> could explain the initial bloat. However, AFAIK that leakage is in
> a transaction-local memory context, so the space ought to be freed at
> transaction end. And Linux's malloc does know about giving space back
> to the kernel (unlike some platforms). So I'm not sure why you're
> seeing persistent bloat.
>
> Can you rewrite the function to not use an EXCEPTION block (perhaps
> a separate SELECT probe for each row --- note this won't be reliable
> if there are concurrent processes making insertions)? If so, does
> that fix the problem?
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
>
--
Bruce Momjian http://candle.pha.pa.us
EnterpriseDB http://www.enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-performance@postgresql.org
Cc: pgman@candle.pha.pa.us, tgl@sss.pgh.pa.us, jody.brownell@Q1Labs.com
Subject: Re: Postgres consuming way too much memory???
In-Reply-To: <200606151717.k5FHHk901846@candle.pha.pa.us>
References: <28419.1150386248@sss.pgh.pa.us> <200606151717.k5FHHk901846@candle.pha.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox