Re: Renaming MemoryContextResetAndDeleteChildren to MemoryContextReset

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Renaming MemoryContextResetAndDeleteChildren to MemoryContextReset
Date: 2015-02-26 22:55:51
Message-ID: 30788.1424991351@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)2ndquadrant(dot)com> writes:
> ... Without a compiler erroring out people won't
> notice that suddenly MemoryContextReset deletes much more; leading to
> possibly hard to find errors.

BTW, so far as *data* is concerned, the existing call deletes all data in
the child contexts already. The only not-already-buggy operation you could
perform before that would no longer work is to allocate fresh data in one
of those child contexts, assuming you still had a pointer to such a
context. I've not seen any coding pattern in which that's likely. The
problem is exactly that whoever's resetting the parent context isn't aware
of child contexts having been attached to it.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2015-02-26 22:57:59 Re: Renaming MemoryContextResetAndDeleteChildren to MemoryContextReset
Previous Message Andres Freund 2015-02-26 22:53:56 Re: Renaming MemoryContextResetAndDeleteChildren to MemoryContextReset