Skip to content

Conversation

@SimonSiefke
Copy link
Contributor

This fixes a few event listener memory leaks in the debug view:

  • Registers the InputBox as disposable to templateDisposables
  • Tracks elementDisposables and templateDisposables separately to clear element event listeners when an element is disposed and template event listeners when the template is disposed
  • Changed the IDisposable Array to a DisposableStore (not really necessary but it seemed easier to work with a DisposableStore)

Before

The number of event listeners when debugging a javascript file 17 times grows from 3220 to 9936:

event-listener-count-old

After

The number of event listeners when debugging a javascript file 17 times grows from 2499 to 3731:

event-listener-count

The number leaking event listeners seems to be ~80% less in this case. Nevertheless, it seems likely that are still additional memory leaks since the number of event listeners is still growing.

Copy link
Member

@roblourens roblourens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good find, thanks!

Copy link
Member

@roblourens roblourens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@roblourens roblourens added this to the September 2024 milestone Sep 10, 2024
@roblourens roblourens enabled auto-merge (squash) September 10, 2024 03:17
@roblourens roblourens merged commit bffae51 into microsoft:main Sep 10, 2024
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Oct 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

3 participants