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
Count the number of callbacks retained by the worker actors:
On the example page, run this in the console: document.getElementById('demo').contentWindow.map.style.dispatcher.actors.reduce((total, actor) => Object.keys(actor.callbacks).length + total, 0)
Expected Behavior
The number of callbacks should rise and fall back to 0
Actual Behavior
The number of callbacks continues to climb as you interact with the map
Background / Details
I'm investigating some an apparent memory leaks (in a much more complicated scenario with auto refreshing data), and I noticed references were being held open by this issue. Basically, the actor saves a callback, but in some cases the worker never calls back since many if its methods don't use the done param. The primary culprits seem to be setLayers and updateLayers in source/worker.js, though I noticed others.
Experimentally clearing them with map.style.dispatcher.actors.forEach(a => a.callbacks = {}) seems to somewhat bring memory usage back down, though not completely.
The text was updated successfully, but these errors were encountered:
I'm trying my hand at a fix for this and I've noticed that loadTile is another leaky event type. It has a callback, so retaining it is correct, but apparently it doesn't always get called back, especially when zooming/panning.
mapbox-gl-js version: 0.40.1
Steps to Trigger Behavior
On the example page, run this in the console:
document.getElementById('demo').contentWindow.map.style.dispatcher.actors.reduce((total, actor) => Object.keys(actor.callbacks).length + total, 0)
Expected Behavior
The number of callbacks should rise and fall back to 0
Actual Behavior
The number of callbacks continues to climb as you interact with the map
Background / Details
I'm investigating some an apparent memory leaks (in a much more complicated scenario with auto refreshing data), and I noticed references were being held open by this issue. Basically, the actor saves a callback, but in some cases the worker never calls back since many if its methods don't use the
done
param. The primary culprits seem to be setLayers and updateLayers in source/worker.js, though I noticed others.Experimentally clearing them with
map.style.dispatcher.actors.forEach(a => a.callbacks = {})
seems to somewhat bring memory usage back down, though not completely.The text was updated successfully, but these errors were encountered: