Fix accumulating memory issue#1297
Conversation
InvestigationRunning the above code snippet, we can see that the memory usage does in fact increase with each call: But there does seem to be some freeing of memory (approximately 20 or so MB) every ~20 calls. I also checked both Pylint and Astroid's changelogs but I couldn't find any fixes related to any memory leak issues. |
|
Thanks @Zain-Mahmoud. I did a bit of digging and found this pylint option: https://pylint.pycqa.org/en/latest/user_guide/configuration/all-options.html#clear-cache-post-run. Could you try to figure out how we can run PythonTA with this option enabled, and whether that fixes the issue? |
|
Hi @david-yz-liu |
|
Alright thanks @Zain-Mahmoud, I think we'll need to do some more research then. There are two tools that you can use to help with memory profiling in Python: tracemalloc, which is a Python built-in module, and memray, which is a third-party package. Please try using those to investigate which parts of the codebase may be resulting in issues. BTW, you could also do some experimentation like commenting out particular components to see if that makes a difference. |
Proposed Changes
This PR aims to fix the issue where repeated calls to the PyTA
check_all()function cause the memory usage of the process to increase with each call (issue #646)....
Screenshots of your changes (if applicable)
Type of Change
(Write an
Xor a brief description next to the type or types that best describe your changes.)Checklist
(Complete each of the following items for your pull request. Indicate that you have completed an item by changing the
[ ]into a[x]in the raw text, or by clicking on the checkbox in the rendered description on GitHub.)Before opening your pull request:
After opening your pull request:
Questions and Comments
(Include any questions or comments you have regarding your changes.)