simonrw / ttvfast-python

Python interface to the TTVFast library
GNU General Public License v2.0
15 stars 6 forks source link

Memory leak #6

Closed simonrw closed 8 years ago

simonrw commented 8 years ago

Original report:

In playing around with ttvfast-python, I think there might be a memory leak. Running once or a few times is fine. But when I use a minimization algorithm such as scipy.optimizie.minimize, the process grows to be several gigabytes! Similarly, I tried using emcee (Daniel Foreman-Mackey's MCMC algorithm) with multithreading, and each thread quickly grew to many gigabytes. By contrast, when I run these algorithms (scipy.optimize.minimize or emcee) without using ttvfast-python, they only take up about 70 MB. Is it possible that ttvfast-python is not clearing up all the memory properly after it runs TTVfast?

simonrw commented 8 years ago

This has been fixed by adding PY_XDECREF calls to the end of the function, cleaning up the temporary list construction: 358f3b88c9041335adb9ec51b4c43c8e03113ff0