Re: Renaming MemoryContextResetAndDeleteChildren to MemoryContextReset

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Renaming MemoryContextResetAndDeleteChildren to MemoryContextReset
Дата
Msg-id 27753.1425044553@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Renaming MemoryContextResetAndDeleteChildren to MemoryContextReset  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Список pgsql-hackers
Andrew Gierth <andrew@tao11.riddles.org.uk> writes:
> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:
>  Tom> We've discussed doing $SUBJECT off and on for nearly ten years,

> So, this is also changing (indirectly) the effect of ReScanExprContext
> so that deletes child contexts too.

Right, this is actually the main point so far as I'm concerned.  My
"expanded arrays" patch currently has  #define ResetExprContext(econtext) \
-    MemoryContextReset((econtext)->ecxt_per_tuple_memory)
+    MemoryContextResetAndDeleteChildren((econtext)->ecxt_per_tuple_memory)

but this is a more general fix.

> I guess the only question is whether anything currently relies on
> ReScanExprContext's current behavior.

I've not seen any regression test failures either with the "expanded
arrays" patch or this one.  It's conceivable that something would create a
context under a short-lived expression context and expect it to still be
there (though empty) after a context reset; that idea was the reason I
designed MemoryContextReset this way in the first place.  But fifteen
years later, it's quite clear that that was a mistake and we don't
actually use contexts that way.

(Worth noting is that the memory context reset callback mechanism
I propose nearby is sort of a second pass at expression shutdown
callbacks, as well.)
        regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: MemoryContext reset/delete callbacks
Следующее
От: "ktm@rice.edu"
Дата:
Сообщение: Re: GSoC idea - Simulated annealing to search for query plans