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

map.setFilter huge memory leak in safari #4562

Closed
stackTom opened this issue Apr 10, 2017 · 4 comments
Closed

map.setFilter huge memory leak in safari #4562

stackTom opened this issue Apr 10, 2017 · 4 comments
Labels
environment-specific 🖥️ performance ⚡ Speed, stability, CPU usage, memory usage, or power usage

Comments

@stackTom
Copy link

mapbox-gl-js version:
0.35.0

Steps to Trigger Behavior

  1. use map.setFilter on a relatively large vector tile source from mbtiles

Expected Behavior

memory use doesn't sky-rocket

Actual Behavior

memory use goes up to 2.00 gb+ and keeps on climbing sometimes. Removing the source doesn't reduce the memory used. This technique works fine on chrome.

Example:
http://insarmaps.rsmas.miami.edu/?startDataset=CSK_HIMAGE_091_0000_20130914-20170116_0000_00000

I am loading vector tiles from a vector tile server. I am then requesting points to filter from the server. The server returns a couple of thousand of point ids, and I use these as a filter on the vector tile layer in order to not display the points with these ids:
var filter = ["in", "p"].concat(pointIDs); map.setFilter(layerID, filter);

On chrome, memory use doesn't rise by much, but in safari for mac os sierra v 10.12.4, memory use goes so high as to cause my 8gb machine to begin to use swap space. If I press the reset button and remove the vector tile source from the map, memory use stops increasing and remains the same until I close the app.

@mourner
Copy link
Member

mourner commented Apr 10, 2017

Thanks for the report! Could you please set up an isolated JSFiddle test case that reproduces the issue? That would make triaging it much easier.

@stackTom
Copy link
Author

Here is the fiddle: http://jsfiddle.net/n9xowfru/7/
Safari seemed to stabilize at around 2.2 gig (chrome at around 280 meg). After I opened a new tab in chrome to respond here on github, safari went crazy, and memory shot up to 16.6 gig before I force quit it (in the below picture, I was able to grab it at 14 gig, but it kept rising after I took the picture). Notice that chrome is at 193 meg, jumping from around 193 to 400+ or so.
Hope this can be fixed, as this is vital to my application.
screen shot 2017-04-10 at 6 28 27 pm

@anandthakker
Copy link
Contributor

anandthakker commented Apr 11, 2017

Here's a slightly modified version of the fiddle where the filter is set only after clicking on the map - might make profiling a little easier: http://jsfiddle.net/xfkysxmw/5/

@mourner mourner added performance ⚡ Speed, stability, CPU usage, memory usage, or power usage environment-specific 🖥️ labels Apr 19, 2017
YunjieLi pushed a commit that referenced this issue Jun 2, 2017
- this is simpler than predicting opacity based on current zooming speed
- this is smoother: symbols don't flicker when changing zoom speed or
  when zooming in and out rapidly.

1df1466

fix #4562
@mourner
Copy link
Member

mourner commented Aug 21, 2020

This was likely fixed by #9003, in addition to being fixed on the WebKit side in https://bugs.webkit.org/show_bug.cgi?id=203990

@mourner mourner closed this as completed Aug 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
environment-specific 🖥️ performance ⚡ Speed, stability, CPU usage, memory usage, or power usage
Projects
None yet
Development

No branches or pull requests

3 participants