[IPython-user] Stranded memory in IPython, what to do?

Wes McKinney wesmckinn@gmail....
Tue Aug 11 16:40:03 CDT 2009


Let me know if anyone has encountered this problem.


In [1]: mat = randn(1000000, 10)

In [2]: del mat

In [3]: mat = randn(1000000, 10)

In [4]: mat
Out[4]:
array([[ 3.07239821,  0.91022579,  0.41997378, ..., -0.35914633,
         0.19312368,  0.35285034],
       [ 0.63808074, -0.84143054,  0.06576777, ...,  1.67678709,
        -1.00791862, -0.53075939],
       [-0.54895189, -0.0638776 , -0.13601076, ..., -0.11612621,
        -0.20053915,  1.34437117],
       ...,
       [ 0.83266841, -1.03629731,  0.12006645, ...,  0.64724573,
        -0.57920575,  1.67329796],
       [-1.72156519,  0.20389525, -0.65863224, ..., -0.02958129,
         0.36914064,  1.86471113],
       [ 0.47292264, -0.75709857, -0.31754774, ...,  1.27135403,
        -0.51109341, -0.13198401]])

In [5]: del mat

In the first case, the ndarray garbage collects right away. In the
second case, I don't believe it ever does. Somewhere the object is
getting stranded. Could someone explain what is going on here / i.e.
is there a way to free this memory once you've done this obj RET
business? %clear out does not seem to do the trick.

Running Python 2.5 on Windows XP, with NumPy 1.3.

Thanks


More information about the IPython-user mailing list