Leaflet / Leaflet

🍃 JavaScript library for mobile-friendly interactive maps 🇺🇦
https://leafletjs.com
BSD 2-Clause "Simplified" License
40.17k stars 5.75k forks source link

Tile events are not being cleaned up #9324

Closed gerhardmeyer closed 1 month ago

gerhardmeyer commented 1 month ago

Checklist

Steps to reproduce

I noticed when zoomin and out on the map the event listeners are growing quite quickly. It looks like the createTile function is creating events inside the TileLayer.js. I don't think these are cleaned up properly.

To reproduce just look at the event listerners inside Chromes performance monitor while zooming in and out. The events keep climbing.

Expected behavior

Events should be cleaned up when calling map.off() or map.remove().

Current behavior

"load" and "error" Events are leaking

Minimal example reproducing the issue

No response

Environment

gerhardmeyer commented 1 month ago

Never mind its just a bit delayed.

lmdc45 commented 5 days ago

Noticed the issue as well. While the delay is no problems on android or desktop, it seems to induce some crash/map reload on iOS due maybe to more strict memory management