From tomo.bbe at gmail.com Fri Dec 2 10:45:46 2011 From: tomo.bbe at gmail.com (James) Date: Fri, 2 Dec 2011 09:45:46 +0000 Subject: [Python.NET] Memory leak with conversion from numpy array to System.Single[] Message-ID: Hi, 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. The following distills the problem. By switching between the two different Array types (Single & 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. import numpy as np import clr from System import Array, Single, Double N = 100000 M = 1000 for i in range(N): # Numpy calculations A = np.random.random( M ) # Convert to single array - creates memory leak sgl_arry = Array[Single](A) # Convert to double array - does NOT create memory leak #dbl_arry = Array[Double](A) # call library requiring Single[] # .... Any help would be appreciated. Thanks, James -------------- next part -------------- An HTML attachment was scrubbed... URL: From btribble at ea.com Fri Dec 2 20:08:03 2011 From: btribble at ea.com (Tribble, Brett) Date: Fri, 2 Dec 2011 11:08:03 -0800 Subject: [Python.NET] Python Tools For Visual Studio Message-ID: If you haven't checked it out, you really should. It lets you write both CPython and IronPython in Visual Studio and you can debug both. It does a pretty good job of dependency and usage tracking so that things like "find all references" and "go to definition" work pretty well, and it even lets you attach to a running process to do debugging in Python and/or a mixed environment. It is a Microsoft open source project, and 3rd party contributions are welcome, but as a DevStudio language plugin, you will need an expensive version of DevStudio to participate. http://pytools.codeplex.com/ Brett -------------- next part -------------- An HTML attachment was scrubbed... URL: From alan.macdonald at hrhgeology.com Wed Dec 7 10:00:00 2011 From: alan.macdonald at hrhgeology.com (Alan Macdonald) Date: Wed, 07 Dec 2011 09:00:00 +0000 Subject: [Python.NET] Multithreading/multiprocessing Message-ID: Hello, has anyone successfully used multithreading or multiprocessing with Python.Net? I tried to multi-thread from the .Net side and the Python.Net libraries seem to have issues in the RunScript method. I had to take an implementation off the web of that method because the shipped method doesn?t seem to work. I then had a working multi-processing example from CPython that I tried from Python.Net but it gives an error 'module' object has no attribute 'argv' When trying to create a process pool by executing the line pool = Pool(processes=4) Is it possible to do multithreading or multiprocessing with Python.Net? Thanks, Alan -------------- next part -------------- An HTML attachment was scrubbed... URL: