pgsql: Small tidyup for commit d41a178b.

Started by Thomas Munroover 3 years ago3 messagescomitters
Jump to latest
#1Thomas Munro
thomas.munro@gmail.com

Small tidyup for commit d41a178b.

A comment was left behind claiming that we needed to use malloc() rather
than palloc() because the corresponding free would run in another
thread, but that's not true anymore. Remove that comment. And, with
the reason being gone, we might as well actually use palloc().

Back-patch to supported releases, like d41a178b.

Discussion: /messages/by-id/CA+hUKG+pdM9v3Jv4tc2BFx2jh_daY3uzUyAGBhtDkotEQDNPYw@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/6a9229da65c9553a1268764d46fb28043b83bfd6

Modified Files
--------------
src/backend/postmaster/postmaster.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Thomas Munro (#1)
Re: pgsql: Small tidyup for commit d41a178b.

Thomas Munro <tmunro@postgresql.org> writes:

Small tidyup for commit d41a178b.
A comment was left behind claiming that we needed to use malloc() rather
than palloc() because the corresponding free would run in another
thread, but that's not true anymore. Remove that comment. And, with
the reason being gone, we might as well actually use palloc().

Hm, doesn't the change to palloc make the following error check redundant?

childinfo = palloc(sizeof(win32_deadchild_waitinfo));
- if (!childinfo)
- ereport(FATAL,
- (errcode(ERRCODE_OUT_OF_MEMORY),
- errmsg("out of memory")));
-
childinfo->procHandle = pi.hProcess;
childinfo->procId = pi.dwProcessId;

regards, tom lane

#3Thomas Munro
thomas.munro@gmail.com
In reply to: Tom Lane (#2)
Re: pgsql: Small tidyup for commit d41a178b.

On Fri, Mar 17, 2023 at 1:36 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:

Thomas Munro <tmunro@postgresql.org> writes:

Small tidyup for commit d41a178b.
A comment was left behind claiming that we needed to use malloc() rather
than palloc() because the corresponding free would run in another
thread, but that's not true anymore. Remove that comment. And, with
the reason being gone, we might as well actually use palloc().

Hm, doesn't the change to palloc make the following error check redundant?

childinfo = palloc(sizeof(win32_deadchild_waitinfo));
- if (!childinfo)
- ereport(FATAL,
- (errcode(ERRCODE_OUT_OF_MEMORY),
- errmsg("out of memory")));
-
childinfo->procHandle = pi.hProcess;
childinfo->procId = pi.dwProcessId;

True. Will fix.