I've replaced
a = array.array()
with
a = [0] * 10000

and it's faster, and doesn't eat all the RAM.  For those who care :)

On 22/07/2011 12:42, Berend De Schouwer wrote:
> The following program has constant (+- 10 MB) memory usage in CPython,
> but it quickly leaks massive amounts of memory in pypy.
>
> It simply assigns one bit of an array to another slice.  The length of
> the array remains constant (so there's nothing to delete from inside the
> program)
>
> pypy-1.5 (pypy-c-jit-43780-b590cf6de419-linux)
>
>
> import array
> import time
>
> a = array.array('i', 'a' * 100000)
> for i in range(1,100000):
>     a[1:1000] = a[2001:3000]
>     time.sleep(0.0001) # So you can go check mem usage.
>
>
> I apologise for the disclaimer
>
>
>
> The contents of and attachments to this e-mail are intended for the addressee 
> only, and may contain the confidential information of UCS Group and/or its 
> subsidiaries.  Any review, use or dissemination thereof by anyone other than 
> the intended addressee is prohibited.  If you are not the intended addressee 
> please notify the writer immediately and destroy the e-mail.  UCS Group 
> Limited and its subsidiaries distance themselves from and accept no liability 
> for unauthorised use of their e-mail facilities or e-mails sent other than 
> strictly for business purposes.
> _______________________________________________
> pypy-dev mailing list
> pypy-dev@python.org
> http://mail.python.org/mailman/listinfo/pypy-dev


The contents of and attachments to this e-mail are intended for the addressee 
only, and may contain the confidential information of UCS Group and/or its 
subsidiaries.  Any review, use or dissemination thereof by anyone other than 
the intended addressee is prohibited.  If you are not the intended addressee 
please notify the writer immediately and destroy the e-mail.  UCS Group Limited 
and its subsidiaries distance themselves from and accept no liability for 
unauthorised use of their e-mail facilities or e-mails sent other than strictly 
for business purposes.
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
http://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to