Patch for unreleased memory in buf_init.c

Started by Ulrich Neumannalmost 24 years ago4 messagespatches
Jump to latest
#1Ulrich Neumann
U_Neumann@gne.de

Hello,

attached is a patch to fix a memory leak in buf_init.c

Ulrich

----------------------------------
This e-mail is virus scanned
Diese e-mail ist virusgeprueft

Attachments:

diffbuf.patchapplication/octet-stream; name=diffbuf.patchDownload+4-0
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Ulrich Neumann (#1)
Re: Patch for unreleased memory in buf_init.c

"Ulrich Neumann" <U_Neumann@gne.de> writes:

attached is a patch to fix a memory leak in buf_init.c

You've *got* to be kidding :-(

regards, tom lane

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Ulrich Neumann (#1)
Re: Patch for unreleased memory in buf_init.c

Oh, I take that back --- I misread where you'd put the free()s.

Hmm, so the point is to reclaim memory during a shmem reinit cycle?
Might be worth doing, but I fear this is unlikely to be the only such
leakage ...

regards, tom lane

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Tom Lane (#3)
Re: Patch for unreleased memory in buf_init.c

I said:

Hmm, so the point is to reclaim memory during a shmem reinit cycle?

But on third think, it doesn't do that either, and in fact is just a
waste of cycles. ShutdownBufferPoolAccess is only called in a backend
that is about to exit, and the storage you propose it should release
is local to that backend ...

So the patch appears harmless but also useless. A backend on-exit
routine is generally only interested in cleaning up state that is
visible to other backends --- I can't see any point in expending cycles
to tidy up local memory that's about to vanish.

regards, tom lane