Re: memory leak in auto_explain

2021-02-02 Thread japin
On Wed, 03 Feb 2021 at 02:13, Tom Lane wrote: > japin writes: >> Here's my analysis: >> 1) In the explain_ExecutorEnd(), it will create a ExplainState on SQL >> function >> memory context, which is a long-lived, cause the memory grow up. > > Yeah, agreed. I think people looking at this have a

Re: memory leak in auto_explain

2021-02-02 Thread Tom Lane
japin writes: > Here's my analysis: > 1) In the explain_ExecutorEnd(), it will create a ExplainState on SQL function > memory context, which is a long-lived, cause the memory grow up. Yeah, agreed. I think people looking at this have assumed that the ExecutorEnd hook would automatically be runni

Re: memory leak in auto_explain

2021-02-02 Thread japin
Any thoughts? -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd. >From 2589cf9c78bbd308b6f300277500c920152ee6f2 Mon Sep 17 00:00:00 2001 From: Japin Li Date: Tue, 2 Feb 2021 17:27:21 +0800 Subject: [PATCH v1] Fix memory leak in auto_explain --- contrib/auto_explain/auto_explain.c | 2 ++ 1 file cha

Re: memory leak in auto_explain

2021-02-01 Thread Jeff Janes
On Mon, Feb 1, 2021 at 6:09 PM Jeff Janes wrote: > > > create or replace function gibberish(int) returns text language SQL as $_$ > select left(string_agg(md5(random()::text),),$1) from > generate_series(0,$1/32) $_$; > > create table j1 as select x, md5(random()::text) as t11, gibberish(1500

memory leak in auto_explain

2021-02-01 Thread Jeff Janes
I accidentally tried to populate a test case while auto_explain.log_min_duration was set to zero. auto_explain.log_nested_statements was also on. create or replace function gibberish(int) returns text language SQL as $_$ select left(string_agg(md5(random()::text),),$1) from generate_series(0,