PL/pgSQL caught exceptions leak memory?

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: PL/pgSQL caught exceptions leak memory?
Date: 2006-02-22 03:59:58
Message-ID: 20060222035958.GA97707@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Caught exceptions in PL/pgSQL appear to leak memory -- is that
expected? Here's a contrived test case:

CREATE FUNCTION foo(n integer) RETURNS void AS $$
BEGIN
FOR i IN 1 .. n LOOP
BEGIN
RAISE EXCEPTION 'test';
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
END LOOP;
END;
$$ LANGUAGE plpgsql VOLATILE STRICT;

SELECT foo(200000);

If you watch the backend with top you should see the process size
grow by around 500-600 (512?) bytes per exception caught (you might
need to use more iterations on a fast system to see the effect).

--
Michael Fuhr

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Browne 2006-02-22 04:31:51 Re: pg_config, pg_service.conf, postgresql.conf ....
Previous Message Andrew Dunstan 2006-02-22 03:24:28 initdb -U wrongness