[SciPy-user] how to crash scipy in 3s! (memory leak?)

Matthieu Brucher matthieu.brucher at gmail.com
Mon May 28 14:12:11 EDT 2007


Hi,

Did you tried xrange instead of range ? range(1e8) eats several hundreds of
MB, what might lead to a crash.

Matthieu

2007/5/28, Nicolas Chopin <nicolas.chopin at bristol.ac.uk>:
>
>     Hi,
> the program below eats all the memory of my computer
> in approx. 3 seconds, making it pretty unstable.
>
> from scipy import *
> def f(a):
>     return rand(1)+a
>
> n = 1e8
> for i in range(n):
>     x += f(0.1)
>
> It looks like a problem with rand()? e.g. rand() forgets
> to free memory? Or am I doing something "forbidden"?
> like returning an array, which creates a reference
> which is never deleted?
> In this case, what is the correct way to do something like
> def f(x):
>     return some_function_of(x, rand(1) )
>
> I use Ubuntu Feisty, Scipy 0.5.2, Numpy 1.01, Python 2.5.1
> (all 3 from Ubuntu repositories).
> The program above is in fact a simplified version of a small bit
> of one of my programs, which was leaking memory too,
> albeit at a slower pace. This problem has bugged me for weeks
> now, before I managed to track it down to this. So any help
> is greatly appreciated!
>
> Cheers
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20070528/5e27d0c0/attachment.html>


More information about the SciPy-User mailing list