On Mon, Jan 25, 2010 at 11:32 AM, Daniel Stutzbach
<dan...@stutzbachenterprises.com> wrote:
> On Mon, Jan 25, 2010 at 1:22 PM, Steve Howell <showel...@yahoo.com> wrote:
>>
>> I haven't completely worked out the best strategy to eventually release
>> the memory taken up by the pointers of the unreleased elements, but the
>> worst case scenario is that the unused memory only gets wasted until the
>> time that the list itself gets garbage collected.
>
> FWIW, for a long-running FIFO queue, it's critical to release some of the
> memory along the way, otherwise the amount of wasted memory is unbounded.
>
> Good luck :)

It seems to me that the best way to do this is invert .append() logic:
leave at most X amount of wasted space at the beginning of the list,
where X is a constant fraction of the list size.

Whether it is worth adding a extra pointer to the data stored by a
list is another story.

-Mike
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to