Add a #[leaky]
attrubute to the language, forcing coder to add this attribute to leaky type definition and leaky function call, otherwise you get a leaky warning when your code compile
While it is possible to create a reference cycle with Arc
which would cause a leak, it's actually relatively rare in practice. You need to both have shared mutability and an (optional!) Arc
back to the same type (transitively) which you hook up later via the shared mutability. That's not to say it can't happen accidentally, but it is uncommon to happen accidentally.
The overhead of marking Arc
usage as #[leaky]
even in cases where it's not even possible for it to cause a leak far outweighs the benefit when it might prevent someone from accidentally making a ref cycle (or more likely, they just put #[leaky]
on everything to avoid the compiler complaining about them using Arc
).
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.