Re: [HACKERS] Per-tuple memory leak in 9.0

2010-08-18 Thread Tom Lane
Dean Rasheed writes: > The problem is that the trigger code assumes that anything it > allocates in the per-tuple memory context will be freed per-tuple > processed, which used to be the case because the loop in ExecutePlan() > calls ResetPerTupleExprContext() once each time round the loop, and >

[HACKERS] Per-tuple memory leak in 9.0

2010-08-18 Thread Dean Rasheed
While testing triggers, I came across the following memory leak. Here's a simple test case: CREATE TABLE foo(a int); CREATE OR REPLACE FUNCTION trig_fn() RETURNS trigger AS $$ BEGIN RETURN NEW; END; $$ LANGUAGE plpgsql; CREATE TRIGGER ins_trig BEFORE INSERT ON foo FOR EACH ROW EXECUTE PROCED