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

Fix memory leak by removing listener #4824

Merged
merged 3 commits into from
Oct 14, 2024
Merged

Fix memory leak by removing listener #4824

merged 3 commits into from
Oct 14, 2024

Conversation

HarelM
Copy link
Collaborator

@HarelM HarelM commented Oct 13, 2024

Launch Checklist

When using a profiler it was evident that the memory leak was coming from a unregistered event when removing the map.

Fixes #4811
Fixes #4650

  • Confirm your changes do not include backports from Mapbox projects (unless with compliant license) - if you are not sure about this, please ask!
  • Briefly describe the changes in this PR.
  • Link to related issues.
  • Include before/after visuals or gifs if this PR includes visual changes.
  • Add an entry to CHANGELOG.md under the ## main section.

After - using 10 map remove.
image

@HarelM HarelM requested a review from ibesora October 13, 2024 07:58
@codecov-commenter
Copy link

codecov-commenter commented Oct 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.99%. Comparing base (c4b083f) to head (9b37b31).
Report is 3 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4824      +/-   ##
==========================================
+ Coverage   87.87%   87.99%   +0.11%     
==========================================
  Files         265      265              
  Lines       37590    37591       +1     
  Branches     2369     2339      -30     
==========================================
+ Hits        33034    33078      +44     
+ Misses       3508     3484      -24     
+ Partials     1048     1029      -19     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@ibesora ibesora left a comment

Choose a reason for hiding this comment

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

Nice catch!
Code changes look good and minimal.
Tested it via adding and removing a map and couldn’t see the memory increasing.

@HarelM HarelM merged commit 21e7dfd into main Oct 14, 2024
15 checks passed
@HarelM HarelM deleted the fix-memory-leak branch October 14, 2024 06:46
@elo58
Copy link

elo58 commented Oct 14, 2024

Amazing!
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Memory leak on map.remove() Memory Leak while interacting with maplibre-gl library
4 participants