Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
945ba50d
Commit
945ba50d
authored
Sep 12, 2007
by
Alvaro Herrera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a memory leak in the autovacuum launcher code. Noted by Darcy Buskermolen,
who reported it privately to me.
parent
68893035
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
3 deletions
+20
-3
src/backend/postmaster/autovacuum.c
src/backend/postmaster/autovacuum.c
+20
-3
No files found.
src/backend/postmaster/autovacuum.c
View file @
945ba50d
...
@@ -55,7 +55,7 @@
...
@@ -55,7 +55,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.5
7 2007/09/11 17:15:33 tgl
Exp $
* $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.5
8 2007/09/12 22:14:59 alvherre
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -1038,6 +1038,9 @@ do_start_worker(void)
...
@@ -1038,6 +1038,9 @@ do_start_worker(void)
avw_dbase
*
avdb
;
avw_dbase
*
avdb
;
TimestampTz
current_time
;
TimestampTz
current_time
;
bool
skipit
=
false
;
bool
skipit
=
false
;
Oid
retval
=
InvalidOid
;
MemoryContext
tmpcxt
,
oldcxt
;
/* return quickly when there are no free workers */
/* return quickly when there are no free workers */
LWLockAcquire
(
AutovacuumLock
,
LW_SHARED
);
LWLockAcquire
(
AutovacuumLock
,
LW_SHARED
);
...
@@ -1048,6 +1051,17 @@ do_start_worker(void)
...
@@ -1048,6 +1051,17 @@ do_start_worker(void)
}
}
LWLockRelease
(
AutovacuumLock
);
LWLockRelease
(
AutovacuumLock
);
/*
* Create and switch to a temporary context to avoid leaking the memory
* allocated for the database list.
*/
tmpcxt
=
AllocSetContextCreate
(
CurrentMemoryContext
,
"Start worker tmp cxt"
,
ALLOCSET_DEFAULT_MINSIZE
,
ALLOCSET_DEFAULT_INITSIZE
,
ALLOCSET_DEFAULT_MAXSIZE
);
oldcxt
=
MemoryContextSwitchTo
(
tmpcxt
);
/* use fresh stats */
/* use fresh stats */
pgstat_clear_snapshot
();
pgstat_clear_snapshot
();
...
@@ -1186,7 +1200,7 @@ do_start_worker(void)
...
@@ -1186,7 +1200,7 @@ do_start_worker(void)
SendPostmasterSignal
(
PMSIGNAL_START_AUTOVAC_WORKER
);
SendPostmasterSignal
(
PMSIGNAL_START_AUTOVAC_WORKER
);
ret
urn
avdb
->
adw_datid
;
ret
val
=
avdb
->
adw_datid
;
}
}
else
if
(
skipit
)
else
if
(
skipit
)
{
{
...
@@ -1197,7 +1211,10 @@ do_start_worker(void)
...
@@ -1197,7 +1211,10 @@ do_start_worker(void)
rebuild_database_list
(
InvalidOid
);
rebuild_database_list
(
InvalidOid
);
}
}
return
InvalidOid
;
MemoryContextSwitchTo
(
oldcxt
);
MemoryContextDelete
(
tmpcxt
);
return
retval
;
}
}
/*
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment