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

[Bug]: Memory Leak in Menu #3164

Closed
1 task done
joekukish opened this issue Apr 28, 2023 · 4 comments · Fixed by #3289
Closed
1 task done

[Bug]: Memory Leak in Menu #3164

joekukish opened this issue Apr 28, 2023 · 4 comments · Fixed by #3289
Labels
bug Something isn't working triage An issue needing triage

Comments

@joekukish
Copy link
Collaborator

joekukish commented Apr 28, 2023

Code of conduct

  • I agree to follow this project's code of conduct.

Impacted component(s)

Menu

Expected behavior

No response

Actual behavior

MenuItemRemovedEvent keeps an instance to an object, which is never cleared. This introduces a leak since the object cannot be garbage collected.

https://studio.webcomponents.dev/edit/C5gyfKCjjMMv14UmjQzr/src/index.ts?p=stories

Screenshots

Screenshot 2023-04-28 at 16 38 02

No response

What browsers are you seeing the problem in?

No response

How can we reproduce this issue?

  1. Go to https://studio.webcomponents.dev/edit/C5gyfKCjjMMv14UmjQzr/src/index.ts?p=stories
  2. Open Chrome DevTools and go to the Memory tab.
  3. Click on Profiles > Head snapshot > Take snapshot
  4. Click the Show / Hide button (10-20 times)
  5. Go to Performance Tab in DevTools, and click on the Trash Icon (garbage collection).
  6. Go to Memory Tab, and take another snapshot
  7. Next to the search field, "All Objects", select Objects allocated between Snapshot 1 and Snapshot 2.

image

8. Search for Detached

image

_item is the MenuItem held inside the event

image

Sample code that illustrates the problem

No response

Logs taken while reproducing problem

No response

@joekukish joekukish added bug Something isn't working triage An issue needing triage labels Apr 28, 2023
@Westbrook
Copy link
Contributor

Would be great to have a slice for slice test scenario for this to compare fixed against. You wouldn't happen to have set something like that up in order to track this down?

@joekukish
Copy link
Collaborator Author

@Westbrook I've added a playground where it can be reproduced and steps of how to find the leak.

@nawazmobusss
Copy link

Hi @Westbrook , Can I kindly ask for an update on this ticket? One of our components is using Menu and we see memory leaks leading to memory crashes in mobile app & safari browser. It would be highly appreciated if this could be addressed soon as we are looking for a public release in 2 weeks.

@najikahalsema
Copy link
Collaborator

@nawazmobusss We will have this ready to go for you in a release this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage An issue needing triage
Projects
None yet
5 participants