Thread

  1. Re: Fix incorrect comments in tuplesort.c

    David G. Johnston <david.g.johnston@gmail.com> — 2025-12-07T23:10:00Z

    On Sun, Dec 7, 2025 at 3:09 PM David Rowley <dgrowleyml@gmail.com> wrote:
    
    > The comment is effectively
    > explaining that we don't want to make the array big enough so that a
    > malloc will always be required.
    
    
    Doesn't what you are saying contradict both the formula (the +1
    post-division) and the comments:
    
    /*
    * Initial size of array must be more than ALLOCSET_SEPARATE_THRESHOLD;
    * see comments in grow_memtuples().
    */
    state->memtupsize = INITIAL_MEMTUPSIZE;
    state->memtuples = NULL;
    
    and in grow_memtuples:
    
    * That shouldn't happen because we chose the
    * initial array size large enough to ensure that palloc will be treating
    * both old and new arrays as separate chunks.
    
    ?
    
    David J.