You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Circular references using Rc in Rust causes memory leaks! An environment can reference a function and a function can reference an environment, creating a circular reference. Possible fixes for the issue could be:
Cloning the outer environment when a function is created instead of keeping a reference to it, this could causes issues with referencing variables before assignment e.g if the environment gets mutated the functions own copy of the environment won't be changed.
Using a Weak reference instead of Rc, this could cause complications with function currying and referencing environments that have been dropped.
Implementing a garbage collector. The dumpster crate looks promising as a drop-in replacement for Rc.
Circular references using
Rc
in Rust causes memory leaks! An environment can reference a function and a function can reference an environment, creating a circular reference. Possible fixes for the issue could be:Weak
reference instead ofRc
, this could cause complications with function currying and referencing environments that have been dropped.Rc
.I have already added the cloning outer reference method into my own mal rust implementation.
Or since the impls are mainly there for demonstration purposes it might not be worth the added complexity of fixing this issue.
The text was updated successfully, but these errors were encountered: