The following bug has been logged online:
Bug reference: 4677
Logged by: aiwaniuk
Email address: aiwaniuk@instytut.com.pl
PostgreSQL version: >8.0
Operating system: linux
Description: memory growth
Details:
i postgres version 8.2, 8.3 and probobly 8.1 there is problem with running
VOLATILE plpgsql function with begin - exception checking that performs
other VOLATILE plpgsql function. if either, first or second performing
removed, problem doesn't shows. here's an example
CREATE FUNCTION info.f()
RETURNS void AS
$BODY$
DECLARE
tmp text;
BEGIN
-- do anything
tmp = md5(random()::text) || md5(random()::text);
RETURN;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;
CREATE or replace FUNCTION info.memory_growth(i_max integer)
RETURNS integer AS
$BODY$
DECLARE
i integer;
BEGIN
i = 0;
WHILE i < i_max LOOP
BEGIN
PERFORM info.f();
EXCEPTION
WHEN OTHERS THEN
--
END;
PERFORM info.f();
i = i + 1;
END LOOP;
RETURN i;
END;$BODY$
LANGUAGE 'plpgsql' VOLATILE;
after running
select info.memory_growth(100000);
please take a look how's memory of client process grows. is there some
logical problem how functions are create ?