OpenLayers arrays are using way too much memory in map with vector tiles
See original GitHub issueDescribe the bug
Even with a very low cacheSize
(configured to 2
, which I think isn’t even recommended), after navigating a bit on a map rendered by OpenLayers (with MVT vector tiles data) the page starts using way too much memory (like > 200MB), which slows down the experience dramatically on smartphones that doesn’t have more than 1GB of RAM.
To Reproduce Steps to reproduce the behavior:
- Open a map with vector tiles (example);
- Navigate a bit on the map, zooming down and up, going to different places of the map;
- See memory usage increase dramatically on Chrome DevTools;
Expected behavior The memory usage should stay more or less the same (< 100 MB), probably by discarding old data automatically.
Additional information
Curiously, most of the memory is used specifically on…arrays (see image below), and that happens only on maps with vector tiles.
Also, this happens both on OpenLayers 5 and on OpenLayers 6, which means the problem isn’t solved and it isn’t specific to cacheSize
(even throught cacheSize seems to help a bit to reduce the memory usage). Curiously, this library seems to be more optimized than Leaflet.VectorGrid, but this specific problem is bothering me a bit.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:11 (3 by maintainers)
Top GitHub Comments
@pecet86 You can fork this repository (by clicking the “Fork” button at the top of https://github.com/openlayers/openlayers, and then create a branch in your fork to create a pull request from.
Now that v6 is released and doesn’t have this problem, I’ll close the issue.
Thanks for fixing this issue. =)