[Patches] [ python-Patches-1022910 ] Conserve memory with list.pop()

SourceForge.net noreply at sourceforge.net
Mon Sep 6 09:16:43 CEST 2004


Patches item #1022910, was opened at 2004-09-06 02:16
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1022910&group_id=5470

Category: Core (C code)
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Raymond Hettinger (rhettinger)
Assigned to: Tim Peters (tim_one)
Summary: Conserve memory with list.pop()

Initial Comment:
The current list resizing scheme only downsizes when
more than 16 elements are removed in a single step: 
del a[100:120].

When popping elements off of a list one at a time, the
current resizing approach never shrinks.

This patch makes it shrink whenever more than half of
the  space is unused.

There may be a better approach.  This one is simple and
avoids thrashing in stack applications that hover up
and down around a nearly steady state.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1022910&group_id=5470


More information about the Patches mailing list