I found a memory leak when exception happens. I was using pygsl 0.95 and gsl 1.13 on Fedora 12, but switching to gsl 1.14 (from Fedora rawhide) gave the same memory leak problem.
Here's a test Python code (I am using blas.dtrmv as an example, although the memory leak happens to many other functions I've tried): ============ from pygsl import blas import numpy import sys def test_pygsl_memory_leak(): n = 2000 A = numpy.zeros([n, n], order='F') # to trigger a sanity check in gsl b = numpy.zeros(n) print sys.getrefcount(A), sys.getrefcount(b) try: l = blas.dtrmv(A[:0, :0], b[:0]) except Exception as e: print e print sys.getrefcount(A), sys.getrefcount(b) ============ And the output: ============ $ python Python 2.6.2 (r262:71600, Jun 4 2010, 18:28:58) [GCC 4.4.3 20100127 (Red Hat 4.4.3-4)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from memory import test_pygsl_memory_leak >>> test_pygsl_memory_leak() 2 2 sanity check failed - shouldn't happen: Stride not one of a contiguous array! 3 3 ============ If one runs it many many times in an interpreter, you will see the memory usage goes up pretty quickly. Thanks. ------------------------------------------------------------------------------ The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://ad.doubleclick.net/clk;226879339;13503038;l? http://clk.atdmt.com/CRS/go/247765532/direct/01/ _______________________________________________ pygsl-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/pygsl-discuss
