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

Resource management in a reflex program #428

Open
expipiplus1 opened this issue May 18, 2020 · 2 comments
Open

Resource management in a reflex program #428

expipiplus1 opened this issue May 18, 2020 · 2 comments

Comments

@expipiplus1
Copy link

I think this is at least an issue with documentation.

It's not clear from reading the examples or the manual how a reflex-frp program might deal with scarce resources, i.e. resources which must be freed promptly (not left up to a finalizer). I'd like to think that FRP would be a good fit for managing complex object lifetimes (particularly object creation when needed). On the other hand from reflex-frp/reflex-dom#114 it looks as guaranteed destruction might be problematic with reflex.

Either way I think it might be good to at least have a footnote or something somewhere with some greppable terms related to resource management.

@ryantrinkle
Copy link
Member

This is definitely something that would be nice to have. Reflex's built-in resource management is all GC-driven, so it's only appropriate for situations where prompt destruction is not required. However, we do have a system that can be leveraged for this: Adjustable. In reflex-dom, when widgets are removed from the DOM, it happens, of course, promptly. We also use this in QueryT to promptly unsubscribe from queries that we're no longer interested in.

My basic idea for this would be that a "disposable" widget provides a "disposal" routine to its parent, inside of a Behavior or a Dynamic. When the widget is removed by Adjustable, the disposal routine will be invoked. Do you think that would cover your use case?

@expipiplus1
Copy link
Author

expipiplus1 commented May 19, 2020 via email

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

3 participants