Find and fix memory retain cycles where two (or more) Rc are pointing in a cycle, making them never released. This can be fixed by changing some Rc into Weak such that strong reference with Rc is only "one-way".
Examples:
-
A function owns the environment in which it is declared, and that environment also owns the function.
For example
{
// Environment "A" owns foo
fun foo() {
// foo's closure references environment "A"
}
}
// Both "A" and foo are not dropped
Consider changing DoveFunction.closure from Rc to Weak.
Find and fix memory retain cycles where two (or more)
Rcare pointing in a cycle, making them never released. This can be fixed by changing someRcintoWeaksuch that strong reference withRcis only "one-way".Examples:
A function owns the environment in which it is declared, and that environment also owns the function.
For example
Consider changing
DoveFunction.closurefromRctoWeak.