gloo icon indicating copy to clipboard operation
gloo copied to clipboard

Question about gloo_timers::callback::Timeout

Open pg-wtatum opened this issue 5 months ago • 0 comments

The example shown at https://docs.rs/gloo-timers/0.3.0/gloo_timers/#timeouts-with-a-callback-function indicates it's okay to forget a timeout if you don't intend to cancel it. I see that Timeout uses Closure::once. Docs on Closure::once indicate that it enforces at runtime that it is only called on time but I didn't see anything indicating if resources associated to the closure are automatically cleaned up (as opposed to being leaked) after it has run.

Will repeatedly calling Timeout::new(...).forget() leak resources?

pg-wtatum avatar Aug 28 '24 12:08 pg-wtatum