Open sthagstotz opened 8 years ago
Hello Steffen,
I was working with Montepython too and I had the same problem of memory leak with the pk()
function. In my case the problem was related to the *pk_ic
pointer and just adding a free(pk_ic)
was enough to avoid the memory leak. So far I haven't noticed any other memory build up.
Hope that it helps!
Best,
Nicola
Hi, I have a likelihood code for Montepython which calls
cosmo.get_transfer()
quite often, and the chains use more and more memory until they crash.I think the problem is in the function definition in classy.pyx: we have
data = <double*>malloc(sizeof(double)*size_ic_data*ic_num)
but data is never freed, and uses memory until python exits. I think there should be afree(data)
free(titles)
before the function ends. The same is true for a lot of other functions like get_background(), get_thermodynamics() or pk().Even then there is a (way slower) memory buildup, but I'm not sure what's causing it. Did anyone have similar problems?
Best, Steffen