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

Commit00fc4b3

Browse files
committed
Small tidyup for commitd41a178.
A comment was left behind claiming that we needed to use malloc() ratherthan palloc() because the corresponding free would run in anotherthread, but that's not true anymore. Remove that comment. And, withthe reason being gone, we might as well actually use palloc().Back-patch to supported releases, liked41a178.Discussion:https://postgr.es/m/CA%2BhUKG%2BpdM9v3Jv4tc2BFx2jh_daY3uzUyAGBhtDkotEQDNPYw%40mail.gmail.com
1 parent8f90381 commit00fc4b3

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

‎src/backend/postmaster/postmaster.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4862,13 +4862,10 @@ internal_forkexec(int argc, char *argv[], Port *port)
48624862

48634863
/*
48644864
* Queue a waiter to signal when this child dies. The wait will be handled
4865-
* automatically by an operating system thread pool.
4866-
*
4867-
* Note: use malloc instead of palloc, since it needs to be thread-safe.
4868-
* Struct will be free():d from the callback function that runs on a
4869-
* different thread.
4865+
* automatically by an operating system thread pool. The memory will be
4866+
* freed by a later call to waitpid().
48704867
*/
4871-
childinfo=malloc(sizeof(win32_deadchild_waitinfo));
4868+
childinfo=palloc(sizeof(win32_deadchild_waitinfo));
48724869
if (!childinfo)
48734870
ereport(FATAL,
48744871
(errcode(ERRCODE_OUT_OF_MEMORY),
@@ -6573,7 +6570,7 @@ waitpid(pid_t pid, int *exitstatus, int options)
65736570
* Free struct that was allocated before the call to
65746571
* RegisterWaitForSingleObject()
65756572
*/
6576-
free(childinfo);
6573+
pfree(childinfo);
65776574

65786575
returnpid;
65796576
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp