On Tue, Jan 27, 2015 at 12:03 AM, Jim Nasby <jim.na...@bluetreble.com>
wrote:

> But one backend can effectively "pin" a buffer more than once, no? If so,
> then ISTM there's some risk that code path A pins and forgets to unpin, but
> path B accidentally unpins for A.
>

The danger is that there's a codepath that refers to memory it doesn't have
a pin on but that there is no actual test in our regression suite that
doesn't actually have a second pin on the same buffer. If there is in fact
no reachable code path at all without the second pin then there's no active
bug, only a bad coding practice. But if there are code paths that we just
aren't testing then that's a real bug.

IIRC CLOBBER_FREED_MEMORY only affects palloc'd blocks. Do we not have a
mode that automatically removes any buffer as soon as it's not pinned? That
seems like it would be a valuable addition.

Fwiw I think our experience is that bugs where buffers are unpinned get
exposed pretty quickly in production. I suppose the same might not be true
for rarely called codepaths or in cases where the buffers are usually
already pinned.


-- 
greg

Reply via email to