-
Notifications
You must be signed in to change notification settings - Fork 0
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
Memory Leaks #1
Comments
@yorrd yes, definitely. This will be fixed when (if) we get a disconnected handler for directives. Besides that, I just noticed that there is also a memory leak when an observable gets replaced with another, since the old observables aren't currently being unsubscribed. I'm going to fix it in the next couple of days. |
@Dabolus great. I'm active in that issue as well, was just wondering if you knew of that. Looking forward to where this is going. Currently, we solve the memory leak issues by extending lit-html with unmount handlers. That's not abstracted away though atm, one part is monkey-patched because the respective API is not public |
@Dabolus @yorrd while we wait for the handlers to be implemented in the next version of I have had a go at it here, have not added any test coverage yet but can confirm the destroy hooks are activated if we remove the bound dom element. It does come with a trade-off in that the custom element needs to use a corresponding mixin: @customElement('my-element')
export class MyElement extends LifecycleMixin(LitElement) {
...
} I don't really want to create/manage a library (lazy) and thinking maybe I could raise a PR against |
@tyroneneill I've implemented this in our stack, but it's very deep inside and not well abstracted away. Looking forward to lit 3.0 to finally fix this the right way |
hey guys, was curious if there is any update on this matter |
@klauss194 at the moment, we're using a custom controller (we call it RXController) that subscribes and unsubscribes on connect / disconnect. You pass an observable and the value is exposed via |
You're subscribing to observables, but they're not being unsubscribed when the part is removed. Doesn't this create memory leaks?
The text was updated successfully, but these errors were encountered: