-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory leaks when importing problems #93
Comments
Thank you for reporting, we've so far been unable to ascertain exactly what is causing this memory leak and whether it is inherent to NumPy, the upstream CUTEst C interface or in fact a mistake in how PyCUTEst uses the Python C API. I will try re-compiling PyCUTEst with the AdressSanitizer as well as running it through Valgrind and see what we can find. |
@anugrahjo I created a simple memory leak test script as follows: import pycutest
prob = pycutest.import_problem('ALLINITC')
prob = None Then I compiled the There are indeed lots of memory leaks, but unfortunately they are all upstream in the Python C API and NumPy:
|
@jfowkes Thanks for the update. I don't have many ideas here on how to pin down the exact source of this, as I'm not very familiar with the design of the interface to CUTEst. However, it looks like the leaks from NumPy are insignificant and should not be a cause for concern. |
@anugrahjo the leaks are coming from deep within Python's C API rather than our interface, e.g. |
@jfowkes That makes sense. After quickly going through the issue you copied above, it looks like it will not be fixed for Python versions <=12.0. Hopefully, it will be resolved in one of the patch releases for py13. |
It seems that the allocated memory (or maybe a portion of it) is never released after a problem is imported.
If I run the following code, the memory usage monotonically increases as the memory allocated for each problem imported is not deallocated. The program consumes several gigabytes of RAM (~8 GB if I skip ~30 problems that take longer times to get imported) by the time it reaches the end of the loop.
I use PyCUTEst 1.7.1 on macOS 14.4 with Python 3.9.13.
I saw similar issues reported before. I don't know if it's possible to be fixed since threads on the other issues mentioned this comes from upstream CUTEst or from memory leaks in Python/NumPy.
The text was updated successfully, but these errors were encountered: