Re: MemoryContext reset/delete callbacks - Mailing list pgsql-hackers

From Tom Lane
Subject Re: MemoryContext reset/delete callbacks
Date
Msg-id 20196.1425075721@sss.pgh.pa.us
Whole thread Raw
In response to Re: MemoryContext reset/delete callbacks  (Andres Freund <andres@2ndquadrant.com>)
List pgsql-hackers
Andres Freund <andres@2ndquadrant.com> writes:
> On 2015-02-26 19:28:50 -0500, Tom Lane wrote:
>> 1. I used ilists for the linked list of callback requests.  This creates a
>> dependency from memory contexts to lib/ilist.  That's all right at the
>> moment since lib/ilist does no memory allocation, but it might be
>> logically problematic.  We could just use explicit "struct foo *" links
>> with little if any notational penalty, so I wonder if that would be
>> better.

> Maybe I'm partial here, but I don't see a problem. Actually the reason I
> started the ilist stuff was that I wrote a different memory context
> implementation ;). Wish I'd time/energy to go back to that...

After further reflection, I concluded that it was better to go with the
low-tech "struct foo *next" approach.  Aside from the question of whether
we really want mcxt.c to have any more dependencies than it already does,
there's the stylistic point that mcxt.c is already managing lists (of
child contexts) that way; it would be odd to have two different list
technologies in use in the one data structure.

You could of course argue that both of these should be changed to slists,
but that would be a matter for a separate patch.  (And frankly, I'm not
so in love with the slist notation that I'd think it an improvement.)

I also rearranged the bool fields as you suggested to avoid wasted padding
space.  I'm still not exactly convinced that it's worth the ugliness, but
it's not worth arguing about.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Arthur Silva
Date:
Subject: Re: logical column ordering
Next
From: Alvaro Herrera
Date:
Subject: Re: deparsing utility commands