pgsql: Fix permanent memory leak in autovacuum launcher

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix permanent memory leak in autovacuum launcher
Date: 2010-11-08 22:01:44
Message-ID: E1PFZma-0004jh-UQ@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix permanent memory leak in autovacuum launcher

get_database_list was uselessly allocating its output data, along some
created along the way, in a permanent memory context. This didn't
matter when autovacuum was a single, short-lived process, but now that
the launcher is permanent, it shows up as a permanent leak.

To fix, make get_database list allocate its output data in the caller's
context, which is in charge of freeing it when appropriate; and the
memory leaked by heap_beginscan et al is allocated in a throwaway
transaction context.

Branch
------
master

Details
-------
http://git.postgresql.org/gitweb?p=postgresql.git;a=commitdiff;h=854ae8c3a6bab2053f8bdbc453787be878ce8c81

Modified Files
--------------
src/backend/postmaster/autovacuum.c | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2010-11-09 03:15:43 pgsql: Fix error handling in temp-file deletion with log_temp_files act
Previous Message Tom Lane 2010-11-08 20:16:17 pgsql: Use appendrel planning logic for top-level UNION ALL structures.