On Friday 26 October 2007 05:39, Robert Crida wrote: > Hi all > > I recently posted about a memory leak in numpy and failed to mention the > version. The leak manifests itself in numpy-1.0.3.1 but is not present in > numpy-1.0.2 > > The following code reproduces the bug: > > import numpy as np > > a = np.array([1.0, 2.0, 3.0]) > while True: > b = str(a) > > What happens above is that is repeatedly converted to a string. The process > size grow quite rapidly. > > Has anyone else come across this? Where do I look to try to correct it? > > Thanks > Robert
I can reproduce this leak: Python 2.5 (r25:51908, Apr 30 2007, 15:03:13) [GCC 3.4.6 (Debian 3.4.6-5)] on linux2 >>> import numpy >>> numpy.version.version '1.0.4.dev4317' >>> a = numpy.array([1.0]) >>> while True: ... b = a.__str__() ... which causes the resident size of the process to grow by about 1MB/s as mentioned earlier. Interestingly, using non-float dtypes does not cause the loop to leak. Karol -- written by Karol Langner Sun Oct 28 00:47:31 EDT 2007 _______________________________________________ Numpy-discussion mailing list [email protected] http://projects.scipy.org/mailman/listinfo/numpy-discussion
