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

Memory leak #3

Open
justinfagnani opened this issue Feb 1, 2019 · 1 comment
Open

Memory leak #3

justinfagnani opened this issue Feb 1, 2019 · 1 comment
Labels
enhancement New feature or request

Comments

@justinfagnani
Copy link

Because all Parts are added to a global Map, they will persist forever, even if the template instance that contained the part is no longer rendered. Fixing this likely requires the directive disconnect feature (lit/lit#283) requested on lit-html, but I wanted to file an issue here to track it.

@andreasbm
Copy link
Owner

I did implement a cleanup functionality that is run every minute when idle to avoid memory leaks. It can be found in https://github.com/andreasbm/lit-translate/blob/master/src/lib/cleanup.ts. I just added a test case for it in #5. You might be able to tell me if I am missing something here, but from my tests this avoids memory leaks. This was the best solution I was able to come up with and it will be obsolete when it is possible to add cleanup logic in directives.

@andreasbm andreasbm added the enhancement New feature or request label Feb 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants