Skip to content
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

Add Weak references #2188

Open
spotandjake opened this issue Nov 5, 2024 · 0 comments
Open

Add Weak references #2188

spotandjake opened this issue Nov 5, 2024 · 0 comments

Comments

@spotandjake
Copy link
Member

spotandjake commented Nov 5, 2024

When working in a garbage collected language sometimes it is nice to have a little bit more control over memory management a common prototype for this is WeakReferences basically references to objects that do not prevent the value from being freed.

I am thinking we have a simple WeakRef type with the operation getValue which will return an option depending on if the object has been freed or not already to maintain program safety.

Weak references have many use cases one such use case is for breaking cyclic chains in the gc which would otherwise fail to be collected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant