Re: Bogus sizing parameters in some AllocSetContextCreate calls - Mailing list pgsql-hackers

From Tomas Vondra
Subject Re: Bogus sizing parameters in some AllocSetContextCreate calls
Date
Msg-id 921fabd9-727a-bf7f-2819-ff39cb6362ae@2ndquadrant.com
Whole thread Raw
In response to Re: Bogus sizing parameters in some AllocSetContextCreate calls  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 08/28/2016 04:41 PM, Tom Lane wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>> Also, I think we ought to replace this code in aset.c:
>
>>     initBlockSize = MAXALIGN(initBlockSize);
>>     if (initBlockSize < 1024)
>>         initBlockSize = 1024;
>>     maxBlockSize = MAXALIGN(maxBlockSize);
>
>> With this:
>
>>     Assert(initBlockSize >= 1024 && initBlockSize == MAXALIGN(initBlockSize));
>>     Assert(maxBlockSize == MAXALIGN(maxBlockSize));
>
> Good idea --- if we'd had it that way, these errors would never have
> gotten committed in the first place.  I'm for doing that only in HEAD
> though.
>

Then maybe also add
    Assert(initBlockSize <= maxBlockSize);

And perhaps also an assert making sure the minContextSize value makes 
sens with respect to the min/max block sizes?

I'm however pretty sure this will have absolutely no impact on profiles. 
It might save a few cycles, but this only runs when creating the memory 
context and all profiles I've seen are about palloc/pfree.

It might matter when creating many memory contexts, but then you 
probably have other things to worry about.

regards

-- 
Tomas Vondra                  http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Bogus sizing parameters in some AllocSetContextCreate calls
Next
From: Tomas Vondra
Date:
Subject: Re: Bogus sizing parameters in some AllocSetContextCreate calls