Re: PATCH: Memory leaks on start-up

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Lee Kindness <lkindness(at)csl(dot)co(dot)uk>
Cc: pgsql-patches(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: PATCH: Memory leaks on start-up
Date: 2003-07-22 13:58:38
Message-ID: 6239.1058882318@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Lee Kindness <lkindness(at)csl(dot)co(dot)uk> writes:
> Guys, attached is a patch to fix two memory leaks on start-up.

I do not like the changes to miscinit.c. In the first place, it is not
a "memory leak" to do a one-time allocation of state for a proc_exit
function. A bigger complaint is that your proposed change introduces
fragile coupling between CreateLockFile and its callers, in order to
save no resources worth mentioning. More, it introduces an assumption
that the globals directoryLockFile and socketLockFile don't change while
the postmaster is running. UnlinkLockFile should unlink the file that
it was originally told to unlink, regardless of what happens to those
globals.

If you are intent on spending code to free stuff just before the
postmaster exits, a better fix would be for UnlinkLockFile to free its
string argument after using it.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Rod Taylor 2003-07-22 14:08:56 Re: create domain ... with check
Previous Message Tom Lane 2003-07-22 13:40:12 Re: tsearch2 for 7.3.X

Browse pgsql-patches by date

  From Date Subject
Next Message Lee Kindness 2003-07-22 14:26:55 Re: PATCH: Memory leaks on start-up
Previous Message Karel Zak 2003-07-22 13:22:03 Czech NLS