-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
GeoJSONWorkerSource leaks memory: it never deletes old WorkerTiles from removed sources/layers #3595
Comments
Thanks for prioritising this! Do you have an estimate of when this may be fixed? |
I tried repro-ing this on the master branch of MGL. The behaviour is slightly different, however it still leaks memory (the retained memory of a worker goes up over time). It now correctly erases old WorkerTiles in the loaded hash, however it still leaks GeoJSONVT's in the _geoJSONIndexes: On MGL 0.26.0: On master: (good) (bad) |
Each GeoJSONVT seems to be separate objects, and so are taking up mem: |
I've pushed a quick PR that removes old sources from _geoJSONIndexes #3602. It appears to help, however the retained memory on the worker thread still grows over time. I can't spot any remaining problems immediately by browsing the references from the worker. |
These fixes appear to slow the memory growth down by an order of magnitude. |
Sorry to comment on closed issue. Do/Did raster sources have an similar issue (memory leak) when they are being removed? What we found to be problematic is the retaining of textures, when removing/re-adding many sources: https://github.com/mapbox/mapbox-gl-js/blob/master/js/render/painter.js#L308 |
@Scarysize this seems to warrant a new GitHub issue. Can you report? |
Will do. Thanks for the fast response. |
mapbox-gl-js version: v0.26.0
Steps to Trigger Behavior
Expected Behavior
Since the amount of data on the map never increases, the retained memory usage of the worker should hit a ceiling.
Actual Behavior
Retained memory usage of the worker increases unboundedly:
If you add a breakpoint in
geojson_worker_source.js
you can see that the worker is retaining the old WorkerTiles for sources/layers which have since been deleted:It looks like the old data never gets deleted -- the 8 workers collectively have references to all of the data from each previous iteration.
The text was updated successfully, but these errors were encountered: