-
Notifications
You must be signed in to change notification settings - Fork 29
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 Usage/Leak #56
Comments
Note that this has nothing to do with multi-threading and will happen in a single-threaded application. In fact, I can easily replicate it in a very small app. I'd love to fix it myself, but I have no idea about how to track down python memory leaks, I'm ASSUMING this is something to do with a cyclic reference? |
OK - one massive source of the issue is the lru_cache directive found in eval_cell. This is causing an unlimited number of EvaluatorContext objects to be kept in memory. Setting a maxsize does help to reduce the issue, but doesn't eliminate it. Commenting out the line however has a massive impact on the memory leak. Further testing will find if the problem is completely eliminated. |
Removing the lru_cache directive has one unexpected side-effect - the cycle detector in EvaluatorContext.eval_cell starts throwing up unexpected and incorrect cycle exceptions when you've got a formula that references the same cell twice. Currently to get this working I've simply commented out the cycle processing, but this would need to be resolved before the issue is fixed. The assumption here is that the seen member of the EvaluatorContext is having cell names added, but they don't then get removed when the execution is complete. |
I'm using XLCalculator as part of a back-end service, and I'm finding that memory is leaking.
Using TraceMalloc, I can see ast_nodes.py consuming more and more memory over time.
Any idea what I can do about this? Is there some method of forcing a garbage collection? Something I can do to release all of the memory that ast_nodes is consuming?
Might this be an issue caused by using XLCalculator from more than one thread?
The text was updated successfully, but these errors were encountered: