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

Wrap memoized values in weak refs #846

Merged
merged 1 commit into from Mar 28, 2016
Merged

Wrap memoized values in weak refs #846

merged 1 commit into from Mar 28, 2016

Conversation

denisdefreyne
Copy link
Member

Memoized values only exist to speed up calculations, and are okay to be garbage-collected when memory pressure rises.

The Wrapper is necessary in order to let the value pointed to by the weak ref behave exactly as the calculation result. In particular, nil is troublesome as it requires syntactic support from Ruby to be handled properly, and weak refs to nil don’t behave the same as nil itself.

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

Successfully merging this pull request may close these issues.

None yet

1 participant