<div dir="ltr">which version of numpy are you using?<br>there seems to be a leak in the scalar return due to the PyObject_Malloc usage in git master, but it doesn't affect 1.8.0<br></div><div class="gmail_extra"><br><br>
<div class="gmail_quote">On Fri, Jan 31, 2014 at 7:20 AM, Chris Laumann <span dir="ltr"><<a href="mailto:chris.laumann@gmail.com" target="_blank">chris.laumann@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">Hi all-</div><div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
<br></div><div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">The following snippet appears to leak memory badly (about 10 MB per execution):</div><div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
<br></div><div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><div style="margin:0px">P = randint(0,2,(30,13))</div><div style="margin:0px"><br></div><div style="margin:0px">
for i in range(50):</div><div style="margin:0px">    print "\r", i, "/", 50</div><div style="margin:0px">    for ai in ndindex((2,)*13):</div><div style="margin:0px">        j = np.sum(P.dot(ai))</div>
<div style="margin:0px"><br></div><div style="margin:0px">If instead you execute (no np.sum call):</div><div style="margin:0px"><br></div><div style="margin:0px"><div style="margin:0px">P = randint(0,2,(30,13))</div><div style="margin:0px">
<br></div><div style="margin:0px">for i in range(50):</div><div style="margin:0px">    print "\r", i, "/", 50</div><div style="margin:0px">    for ai in ndindex((2,)*13):</div><div style="margin:0px">        j = P.dot(ai)</div>
<div style="margin:0px"><br></div><div style="margin:0px">There is no leak. </div></div><div style="margin:0px"><br></div></div><div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
Any thoughts? I’m stumped.</div><div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><br></div><div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
Best, Chris</div><span class="HOEnZb"><font color="#888888"><div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><br></div> <div><span style="font-family:helvetica,arial;font-size:13px"></span>-- <br>
Chris Laumann<br><span>Sent with Airmail</span></div></font></span></div><br>_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion" target="_blank">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
<br></blockquote></div><br></div>