memory recycling/garbage collecting problem

Aaron Brady castironpi at gmail.com
Tue Feb 17 03:33:27 EST 2009


On Feb 16, 11:21 pm, Yuanxin Xi <xi11w... at gmail.com> wrote:
> I'm having some problems with the memory recycling/garbage collecting
> of the following testing code:
>
> >>> a=[str(i) for i in xrange(10000000)]
>
> This takes 635m/552m/2044 memory (VIRT/RES/SHR)
>
> >>> b={}
> >>> for i in xrange(10000000):
>
> ...     b[str(i)]=i
>
> Then the memory usage increased to 1726m/1.6g/2048
>
> >>> del b
>
> I expect the memory usage drop to the ammount before b was
> created(635m/552m/2044), but it's actually 1341m/1.2g/2048
snip

'gc.collect()' -- I believe, but I'm not the specialist in it.




More information about the Python-list mailing list