Re: Avoid handle leak (src/bin/pg_ctl/pg_ctl.c)

Daniel Gustafsson <daniel@yesql.se>

From: Daniel Gustafsson <daniel@yesql.se>
To: Ranier Vilela <ranier.vf@gmail.com>
Cc: Álvaro Herrera <alvherre@kurilemu.de>, Michael Paquier <michael@paquier.xyz>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2025-10-24T18:36:50Z
Lists: pgsql-hackers
> On 24 Oct 2025, at 14:40, Ranier Vilela <ranier.vf@gmail.com> wrote:
> Em sex., 24 de out. de 2025 às 09:24, Álvaro Herrera <alvherre@kurilemu.de <mailto:alvherre@kurilemu.de>> escreveu:

>> Hmm?  That makes no sense.  Do you have references to documentation that
>> says the system works the way you claim?
> There are a bunch of messages on the web.
> Some are:
> "insufficient system resources exist to complete the requested service"

None of the these links back up the claim that exit() wont release resources
under Windows.  The "Terminating a Process" article on MSDN does however have
this to say about the subject:

   Terminating a process has the following results:

   * Any remaining threads in the process are marked for termination.
   * Any resources allocated by the process are freed.
   * All kernel objects are closed.
   * The process code is removed from memory.
   * The process exit code is set.
   * The process object is signaled.

--
Daniel Gustafsson