Re: Renaming MemoryContextResetAndDeleteChildren to MemoryContextReset - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Renaming MemoryContextResetAndDeleteChildren to MemoryContextReset
Date
Msg-id 30788.1424991351@sss.pgh.pa.us
Whole thread Raw
In response to Re: Renaming MemoryContextResetAndDeleteChildren to MemoryContextReset  (Andres Freund <andres@2ndquadrant.com>)
List pgsql-hackers
Andres Freund <andres@2ndquadrant.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



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Renaming MemoryContextResetAndDeleteChildren to MemoryContextReset
Next
From: Tom Lane
Date:
Subject: Re: Renaming MemoryContextResetAndDeleteChildren to MemoryContextReset