• Tom Lane's avatar
    Redefine MemoryContextReset() as deleting, not resetting, child contexts. · eaa5808e
    Tom Lane authored
    That is, MemoryContextReset() now means what was formerly meant by
    MemoryContextResetAndDeleteChildren(), and the latter is now just a macro
    alias for the former.  If you really want the functionality that was
    formerly provided by MemoryContextReset(), what you have to do is
    MemoryContextResetChildren() plus MemoryContextResetOnly() (which is a
    new API to reset *only* the named context and not touch its children).
    
    The reason for this change is that near fifteen years of experience has
    proven that there is noplace where old-style MemoryContextReset() is
    actually what you want.  Making that the default behavior has led to lots
    of context-leakage bugs, while we've not found anyplace where it's actually
    necessary to keep the child contexts; at least the standard regression
    tests do not reveal anyplace where this change breaks anything.  And there
    are upcoming patches that will introduce additional reasons why child
    contexts need to be removed.
    
    We could change existing calls of MemoryContextResetAndDeleteChildren to be
    just MemoryContextReset, but for the moment I'll leave them alone; they're
    not costing anything.
    eaa5808e
memutils.h 5.5 KB