You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Worker class has several caches (layerIndexes, availableImages, workerSources, demWorkerSources) that use mapId as a key. It looks like they won’t get cleaned up by map.remove() (or anything else except terminating the worker), and thus leak memory if you remove and create new maps often (e.g. inside a single-page app).
You can observe this in Chrome DevTools "Memory" tab (memory usage for the worker keeps growing), or directly by looking at the data (select the worker in "Console" tab and print Object.keys(worker.layerIndexes)).
I guess the way to fix this would be to send a removeMap message to the Worker? I can do a PR for that next...
The text was updated successfully, but these errors were encountered:
pasieronen
added a commit
to pasieronen/maplibre-gl-js
that referenced
this issue
Feb 22, 2024
maplibre-gl-js version: 4.0.2
browser: Chrome 122.0.6261.57
DEMO: https://jsbin.com/moburomadu/edit?html,output
The
Worker
class has several caches (layerIndexes, availableImages, workerSources, demWorkerSources) that use mapId as a key. It looks like they won’t get cleaned up bymap.remove()
(or anything else except terminating the worker), and thus leak memory if you remove and create new maps often (e.g. inside a single-page app).You can observe this in Chrome DevTools "Memory" tab (memory usage for the worker keeps growing), or directly by looking at the data (select the worker in "Console" tab and print
Object.keys(worker.layerIndexes)
).I guess the way to fix this would be to send a
removeMap
message to the Worker? I can do a PR for that next...The text was updated successfully, but these errors were encountered: