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
Timer objects are not being gc'ed #3763
Comments
This was intentional also. It has also been used frequently to create graphics handler callbacks. Other callback based objects, such as processes work the same way. The object will be gc'd after the timer is stopped. (e.g. |
Can this behavior be set explicitly after the object has been created - something like The default behavior, would free the underlying resource as well as the object on gc. |
I would reason about this as follows. If we stop timers that have no references to them, then all you have to do to make a "permanent" timer is keep a reference (e.g. in a global variable), which is very easy to do. But if we keep timers running even with no references, then if you forget to clean up on some code path, you are left with a running timer that is impossible to stop. Now, it is a little strange for a timer to suddenly stop just because the GC kicked in, but given the asymmetry above (a situation that's easy to fix vs. impossible to fix), @amitmurthy might be right. It is true that the current behavior was intentional, and we do take advantage of it in Tk. But it doesn't seem so bad to me just to keep a reference to the timer you need to keep running. |
I disagree. This is very much akin to starting a Task. Should a task just cease to exit because we don't have a user-facing reference to it? Perhaps it would be better to instead add machinery to give you the ability to introspect all running timers? |
I think this was settled by #11669. Now timers just run until you call |
Stdlib: Pkg URL: https://github.com/JuliaLang/Pkg.jl.git Stdlib branch: master Julia branch: master Old commit: a0851bcfd New commit: ed7a8dca8 Julia version: 1.12.0-DEV Pkg version: 1.12.0 Bump invoked by: @IanButterworth Powered by: [BumpStdlibs.jl](https://github.com/JuliaLang/BumpStdlibs.jl) Diff: JuliaLang/Pkg.jl@a0851bc...ed7a8dc ``` $ git log --oneline a0851bcfd..ed7a8dca8 ed7a8dca8 add note about `activate -` to command help (#3888) c26ad23e9 Use `Base.format_bytes` (#3763) c59b37ffd add hint kwarg to complete_line (#3886) ``` Co-authored-by: Dilum Aluthge <dilum@aluthge.com>
I think it is better to treat timer objects as any other regular objects and clean them up as soon as any reference to them from user code is lost.
Same issue as #3567 I guess - just creating a new issue so that it is tracked.
The text was updated successfully, but these errors were encountered: