<div>Hi,</div>
<div> </div>
<div>I have been using Python for .Net quite successfully to access an I/O library that allows me to perform some numerical calculations in Numpy. This library primarily requires the data to be fed back as Single Arrays. However when I perform many conversions from numpy arrays (or even just lists) to Single[] I am experiencing a memory leak that eventually causes a crash. </div>

<div> </div>
<div>The following distills the problem. By switching between the two different Array types (Single &amp; Double) the leak is controlled so it would seem there is some issues with Single. It does not appear to matter whether change the dtype of the numpy array to float32. I have also tried Array.ConvertAll but the same problem arrises. </div>

<div> </div>
<div> </div>
<div>import numpy as np<br>import clr<br>from System import Array, Single, Double</div>
<div>N = 100000<br>M = 1000</div>
<div>for i in range(N):</div>
<div>    # Numpy calculations<br>    A = np.random.random( M )<br> <br>    # Convert to single array - creates memory leak<br>    sgl_arry = Array[Single](A)<br> <br>    # Convert to double array - does NOT create memory leak<br>
    #dbl_arry = Array[Double](A) <br> <br>    # call library requiring Single[]<br>    # ....</div>
<div> </div>
<div> </div>
<div> </div>
<div>
<div>Any help would be appreciated.</div>
<div> </div>
<div>Thanks,</div>
<div>James</div></div>