• Raymond Hettinger's avatar
    SF #1022910: Conserve memory with list.pop() · a84f3abb
    Raymond Hettinger authored
    The list resizing scheme only downsized when more than 16 elements were
    removed in a single step:  del a[100:120].   As a result, the list would
    never shrink when popping elements off one at a time.
    
    This patch makes it shrink whenever more than half of the space is unused.
    
    Also, at Tim's suggestion, renamed _new_size to new_allocated.  This makes
    the code easier to understand.
    a84f3abb
listobject.c 67.6 KB