>>>>> "Tom" == Tom Lane <t...@sss.pgh.pa.us> writes:
Tom> This is the first attempt at weaponizing the memory context Tom> reset/delete feature, and I'm fairly happy with it, except for one Tom> thing: I had to #include utils/memnodes.h into typcache.h in order Tom> to preserve the intended property that the callback structs could Tom> be included directly into structs using them. Now, that's not Tom> awful in itself, because typcache.h isn't used everywhere; but if Tom> this feature gets popular we'll find memnodes.h being included Tom> pretty much everywhere, which is not so great. I'm thinking about Tom> moving struct MemoryContextCallback and the extern for Tom> MemoryContextRegisterResetCallback into palloc.h to avoid this. Tom> Maybe that's too far in the other direction. 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) -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers