Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdd7444c

Browse files
committed
Fix memory management for new variables -- they must actually survive
transaction end, in case we decide to do a vacuum analyze (which is done in twoxacts).
1 parent9ddfe03 commitdd7444c

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

‎src/backend/postmaster/autovacuum.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
*
5656
*
5757
* IDENTIFICATION
58-
* $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.64 2007/10/2514:45:55 alvherre Exp $
58+
* $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.65 2007/10/2519:13:37 alvherre Exp $
5959
*
6060
*-------------------------------------------------------------------------
6161
*/
@@ -2099,11 +2099,9 @@ do_autovacuum(void)
20992099

21002100
/*
21012101
* Save the relation name for a possible error message, to avoid a
2102-
* catalog lookup in case of an error. We do it in
2103-
* TopTransactionContext so that they go away automatically in the next
2104-
* iteration.
2102+
* catalog lookup in case of an error. Note: they must live in a
2103+
* long-lived memory context.
21052104
*/
2106-
MemoryContextSwitchTo(TopTransactionContext);
21072105
datname=get_database_name(MyDatabaseId);
21082106
nspname=get_namespace_name(get_rel_namespace(tab->at_relid));
21092107
relname=get_rel_name(tab->at_relid);
@@ -2116,6 +2114,7 @@ do_autovacuum(void)
21162114
PG_TRY();
21172115
{
21182116
/* have at it */
2117+
MemoryContextSwitchTo(TopTransactionContext);
21192118
autovacuum_do_vac_analyze(tab->at_relid,
21202119
tab->at_dovacuum,
21212120
tab->at_doanalyze,
@@ -2152,6 +2151,9 @@ do_autovacuum(void)
21522151

21532152
/* be tidy */
21542153
pfree(tab);
2154+
pfree(datname);
2155+
pfree(nspname);
2156+
pfree(relname);
21552157

21562158
/* remove my info from shared memory */
21572159
LWLockAcquire(AutovacuumLock,LW_EXCLUSIVE);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp