On 25/11/2013 19:19, Alex Shevtsov wrote: >> Excellent. This was with GSL version 1.16? > > No, I compiled it all with GSL 1.15 from Ubuntu 12.04 repositories. But > still I see no leaks in the C-version, while there is something in the > Cython/Python version. > >> Sometimes scripting environments or shared libraries will "hold >> on" to memory until they exit or until they're asked to let go (e.g. >> Intel MKL and FFTW both do this). > > Probably it is the problem of a Python interpreter. It has an automatic > garbage collector, which is probably invoked in the end, when all the loops > are finished. But while they were running, the memory was being consumed. I > never had any problems with it before though. > > I have to think how to work-around these difficulties. Any suggestions are > very appreciated.
Python memory management should not be the problem here, at least if you are not leaking references to unused objects. I believe Cython itself, is unlikely the responsible for the memory leak, because it does not do much memory allocation. If the same code written in C does not exhibit the memory leak, I believe the problem may be in your wrapping of GSL in Cython. Would you like to share your code, at least the part that exhibits the memory leak? Cheers, Daniele
