memory leak in auto_explain
Jeff Janes <jeff.janes@gmail.com>
From: Jeff Janes <jeff.janes@gmail.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2021-02-01T23:09:16Z
Lists: pgsql-hackers
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,$1/32) $_$;
create table j1 as select x, md5(random()::text) as t11, gibberish(1500) as
t12 from generate_series(1,20e6) f(x);
I got logorrhea of course, but I also got a memory leak into the SQL
function context:
TopPortalContext: 8192 total in 1 blocks; 7656 free (0 chunks); 536 used
PortalContext: 16384 total in 5 blocks; 5328 free (1 chunks); 11056
used: <unnamed>
ExecutorState: 4810120 total in 13 blocks; 4167160 free (74922
chunks); 642960 used
SQL function: 411058232 total in 60 blocks; 4916568 free (4
chunks); 406141664 used: gibberish
The memory usage grew until OOM killer stepped in.
Cheers,
Jeff
Commits
-
Fix ancient memory leak in contrib/auto_explain.
- f0f9ed68d3f5 9.5.25 landed
- 7428469586e8 12.6 landed
- 608cf2bfd9ec 9.6.21 landed
- 5fc5ff61ce49 11.11 landed
- 5c0f7cc54421 14.0 landed
- 586891394344 13.2 landed
- 2671125c75c0 10.16 landed