You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I thought this was fixed but it's clear that context has a memory leak. This is a small repro and and in Chrome you can see how the DOM nodes grow and the garbage collector can not remove the about view because it has subscribe: true. If you use Edge to look at detached elements it's more clear that the detached elements are building up as you navigate between home and about multiple times. This is a link to a repro https://lit-context-example.vercel.app/ and this is the repository if you wish to test it without subscribe set to true. When you do, the garbage collector can remove the about view as expected. https://github.com/marcuslindblom/lit-context-example
maintaining callbacks and growing after every new subscription.
Verified by adding a console.log('we are adding a callback!', this.callbacks.size); message. When switching back and forth between components in the bug reproduction, the size of the callbacks grows. Nothing disposes the callbacks.
Which package(s) are affected?
Context (@lit-labs/context)
Description
Issue captured by: https://discord.com/channels/1012791295170859069/1097902841265393716/1116635815527858237
Text from the comment:
I thought this was fixed but it's clear that context has a memory leak. This is a small repro and and in Chrome you can see how the DOM nodes grow and the garbage collector can not remove the about view because it has subscribe: true. If you use Edge to look at detached elements it's more clear that the detached elements are building up as you navigate between home and about multiple times. This is a link to a repro https://lit-context-example.vercel.app/ and this is the repository if you wish to test it without subscribe set to true. When you do, the garbage collector can remove the about view as expected. https://github.com/marcuslindblom/lit-context-example
Thank you @marcuslindblom for reporting this issue
Reproduction
Live repro: https://lit-context-example.vercel.app/
Source code repro: https://github.com/marcuslindblom/lit-context-example
Repro:
This leak results in Nodes accumulating over time.
Workaround
N/A
Is this a regression?
No or unsure. This never worked, or I haven't tried before.
Affected versions
lit-labs/context latest
Browser/OS/Node environment
N/a
The text was updated successfully, but these errors were encountered: