PL/pgSQL caught exceptions leak memory? - Mailing list pgsql-hackers

From Michael Fuhr
Subject PL/pgSQL caught exceptions leak memory?
Date
Msg-id 20060222035958.GA97707@winnie.fuhr.org
Whole thread Raw
Responses Re: PL/pgSQL caught exceptions leak memory?
List 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


pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: initdb -U wrongness
Next
From: "Mark Woodward"
Date:
Subject: Re: pg_config, pg_service.conf, postgresql.conf ....