"Nigel J. Andrews" <nandrews@investsystems.co.uk> writes:
> On Sat, 19 Oct 2002, Tom Lane wrote:
>> I'm not sure where the leak is in your plpython example, but I'd be
>> inclined to look to plpython itself, perhaps even just the string
>> concatenation expression in
>> plan = plpy.prepare("SELECT " + repr(a))
> Well it's not that string operation.
Actually, I'll bet it's this code in PLy_spi_prepare:
plan->plan = SPI_prepare(query, plan->nargs, plan->types);// error check
plan->plan = SPI_saveplan(plan->plan);// error check
The copy of the plan that's returned by SPI_prepare is being blithely
lost --- and since it's in the procCxt, it won't go away until the
plpython function is exited. Need a SPI_freeplan() here, I think.
Can you check it out and send a patch?
regards, tom lane