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 with adding/removing block components #9177

Closed
2 of 6 tasks
nwhittaker opened this issue Apr 23, 2024 · 3 comments
Closed
2 of 6 tasks

Memory leak with adding/removing block components #9177

nwhittaker opened this issue Apr 23, 2024 · 3 comments
Assignees
Labels
4 - verified Issues that have been released and confirmed resolved. ArcGIS Field Apps Issues logged by ArcGIS Field Apps team members. bug Bug reports for broken functionality. Issues should include a reproduction of the bug. calcite-components Issues specific to the @esri/calcite-components package. estimate - 2 Small fix or update, may require updates to tests. impact - p2 - want for an upcoming milestone User set priority impact status of p2 - want for an upcoming milestone p - high Issue should be addressed in the current milestone, impacts component or core functionality

Comments

@nwhittaker
Copy link
Contributor

nwhittaker commented Apr 23, 2024

Check existing issues

Actual Behavior

Detached <calcite-block> elements are unexpectedly retained in memory.

Expected Behavior

They are not unexpectedly retained in memory.

Reproduction Sample

https://codepen.io/nwhittaker-esri/pen/YzMBXVY

Reproduction Steps

  1. Visit the repro and open dev tools to the Memory tab.
  2. Click the Replace button button several times to remove the current button element and replace it with a new one each time.
  3. If no messages appear in the console, click the Collect garbage button in the dev tool's Memory tab.
  4. At this point, several messages should appear showing the removed button elements have been garbage collected.
  5. Click the Replace block button several times to remove the current block element and replace it with a new one each time.
  6. Click the Collect garbage button and see no messages are printed to the console. If the blocks were garbage collected, their messages should appear.

Reproduction Version

2.7.1

Relevant Info

Looking at the memory dump, it looks like these blocks might be being over-retained by a mutation observer. Since the observer is shared code, other components may be exhibiting a similar memory leak.

Regression?

No response

Priority impact

p2 - want for current milestone

Impact

The memory leak is an issue that may become more noticeable as the team writes larger and more complex custom components. Performance issues may become noticeable to users on slower hardware.

To provide a granular editing experience, we stack panels on top of each other. The top panel organizes different custom components into calcite-blocks. We're seeing each new instance of our custom components being retained. So, if the user opens/closes the panel 6 times, 6 instances of each of our custom components are retained and never garbage collected.

Calcite package

  • @esri/calcite-components
  • @esri/calcite-components-angular
  • @esri/calcite-components-react
  • @esri/calcite-design-tokens
  • @esri/eslint-plugin-calcite-components

Esri team

ArcGIS Field Apps

@nwhittaker nwhittaker added bug Bug reports for broken functionality. Issues should include a reproduction of the bug. 0 - new New issues that need assignment. needs triage Planning workflow - pending design/dev review. labels Apr 23, 2024
@github-actions github-actions bot added impact - p2 - want for an upcoming milestone User set priority impact status of p2 - want for an upcoming milestone ArcGIS Field Apps Issues logged by ArcGIS Field Apps team members. calcite-components Issues specific to the @esri/calcite-components package. labels Apr 23, 2024
@jcfranco jcfranco self-assigned this Apr 26, 2024
@jcfranco jcfranco added 1 - assigned Issues that are assigned to a sprint and a team member. and removed 0 - new New issues that need assignment. labels Apr 26, 2024
@jcfranco
Copy link
Member

Thanks for reporting this. Taking a look. 🔍👁️👄👁️

@jcfranco jcfranco added the p - high Issue should be addressed in the current milestone, impacts component or core functionality label Apr 26, 2024
@jcfranco jcfranco added this to the 2024-04-30 - Apr Release milestone Apr 26, 2024
@jcfranco jcfranco added 2 - in development Issues that are actively being worked on. estimate - 2 Small fix or update, may require updates to tests. and removed 1 - assigned Issues that are assigned to a sprint and a team member. needs triage Planning workflow - pending design/dev review. labels Apr 26, 2024
jcfranco added a commit that referenced this issue Apr 27, 2024
…d slots (#9208)

**Related Issue:** #9177

## Summary

Fixes an issue caused by `conditionalSlot` implementing `unobserve` on
top of `ExtendedMutationObserver`, which already implements it.
@jcfranco jcfranco added 3 - installed Issues that have been merged to master branch and are ready for final confirmation. and removed 2 - in development Issues that are actively being worked on. labels Apr 27, 2024
Copy link
Contributor

Installed and assigned for verification.

@DitwanP
Copy link
Contributor

DitwanP commented Apr 29, 2024

🍰 Verified in 2.8.0-next.16 🗑️🧹
https://codepen.io/Ditwan-Price/pen/NWmmmXb

@DitwanP DitwanP closed this as completed Apr 29, 2024
@DitwanP DitwanP added 4 - verified Issues that have been released and confirmed resolved. and removed 3 - installed Issues that have been merged to master branch and are ready for final confirmation. labels Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4 - verified Issues that have been released and confirmed resolved. ArcGIS Field Apps Issues logged by ArcGIS Field Apps team members. bug Bug reports for broken functionality. Issues should include a reproduction of the bug. calcite-components Issues specific to the @esri/calcite-components package. estimate - 2 Small fix or update, may require updates to tests. impact - p2 - want for an upcoming milestone User set priority impact status of p2 - want for an upcoming milestone p - high Issue should be addressed in the current milestone, impacts component or core functionality
Projects
None yet
Development

No branches or pull requests

4 participants