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

Retain cycle #14

Open
nicklockwood opened this issue Mar 4, 2018 · 0 comments
Open

Retain cycle #14

nicklockwood opened this issue Mar 4, 2018 · 0 comments

Comments

@nicklockwood
Copy link

I’m not at a computer right now so I can’t verify this, but it looks to me like your approach to handling forward references (using the Deferred class) might introduce a retain cycle.

My own Consumer library has a similiar design to yours, and I originally used a similar approach of using a class as a proxy for forward references, but I couldn’t find a way to break the cycle, because the parser enum is a value type.

One option is to wrap the parser enum in a class so it can be weakly referenced, but that seems like it would hurt performance, and it makes the API less elegant.

In the end I solved it by referencing using a string label instead of a pointer.

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

No branches or pull requests

1 participant