>>>>> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:
Tom> This is the first attempt at weaponizing the memory contextTom> reset/delete feature, and I'm fairly happy with
it,except for oneTom> thing: I had to #include utils/memnodes.h into typcache.h in orderTom> to preserve the intended
propertythat the callback structs couldTom> be included directly into structs using them. Now, that's notTom> awful in
itself,because typcache.h isn't used everywhere; but ifTom> this feature gets popular we'll find memnodes.h being
includedTom>pretty much everywhere, which is not so great. I'm thinking aboutTom> moving struct MemoryContextCallback
andthe extern forTom> MemoryContextRegisterResetCallback into palloc.h to avoid this.Tom> Maybe that's too far in the
otherdirection. Thoughts?Tom> Compromise ideas?
This was pretty much my first thought on looking at the callback
patch. It may seem logical to put the reset callback stuff in
memutils/memnodes alongside context creation and reset and so on, but in
fact the places that are going to want to use callbacks are primarily
_not_ the places that are doing their own context management - since
those could do their own cleanup - but rather places that are allocating
things in contexts supplied by others. So palloc.h is the place for it.
--
Andrew (irc:RhodiumToad)