OSDN Git Service

Fix permanent memory leak in autovacuum launcher
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Mon, 8 Nov 2010 21:35:42 +0000 (18:35 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Mon, 8 Nov 2010 21:36:55 +0000 (18:36 -0300)
commit0f0294930420133c7254ac0e3b3a40b8ad74dc80
treea5bfa4aab6905745b46cc3acf0523b1d8e24a579
parentba007262a7661234588b1ebe297e3a95924ba587
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.
src/backend/postmaster/autovacuum.c