-
Notifications
You must be signed in to change notification settings - Fork 37
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 leak using func_timeout . #9
Comments
First, is this in python2 or python3? Second, everything should be referenced in the garbage collector. You can access this via the "gc" module, and "gc.collect" (takes optional "generation" argument) will garbage collect. The garbage collector SHOULD be independent, but it is possible that there is a bug in python2 that is keeping a reference on the dead thread (related to issue #10, see my latest update). You can play around with the gc module to track your objects, and see if they still hold reference (they should not). "gc.get_referrers(ReturnValue)" for example, will show you WHAT is specifically still holding reference to that variable. I can look into this more for you in a bit, but my time is a bit limited right now due to personal life things. Thanks! |
btw, I should add that the "del" statement does NOT free memory, it just removes a reference. So the garbage collector still needs to run for it to clean up. You can probably just run gc.collect() after the exception is raised and everything will be honkey-dorey [this will also happen automatically after a configurable number of objects in each generation, and upon certain triggers], but in the case that it does not, see the additional methods available in the previous comment! |
Im able to reproduce it using python2:
Also with the help of mprof you can see that the memory is increasing each time, better with a function that is expensive memory wise. |
Same Problem, I wonder if this is caused by raising of FunctionTimedOut, which eval all args inside a string msg |
Here is my python function where I use func_timeout.
without func_timeout memory leak is not found in this code.
I also try to free an object using del obj, but no changes were detected.
using del obj, python code
so how can I free my memory ??
The text was updated successfully, but these errors were encountered: