World Map (Leaflet plugin) AJAX reload issue - leaflet object and children not properly disposed, cause memory leak

We use the World Map (leaflet plugin) on our dashboard that we would like to leave running 24/7 on a large format display. We currently cannot because there is a memory leak that I think is in the way that the widgets get reloaded via AJAX call “function widget_reload(id,data_type)”. The documentation for leaflet states that the function “remove()” should be used to properly garbage collect a map and its children.

The issue is that over enough time, these abandoned objects add up in used memory to the browser, and eventually crash the browser instance.

I appears that in “widget_reload”, the entire grid is called to be destroyed, but the map object and its children get abandoned. I think, if before that action takes place, if it could be checked that if this grid contains the leaflet plugin, then to call the function “map.remove()”, this would resolve the issue of abandoned map objects (memory leak).

Demonstration of increasing memory use, and objects abandoned.

Hi,

You should submit your code changes in git hub as pull request. That would help every one including you and this will get the ball rolling.

Thanks

I haven’t changed any code. I’ve simply thrown my hat in trying to identify where the leak occurs, and wanted to offer that info up here.
I’m not the admin. I’m pretty restricted as to what I can do for our instance of LibreNMS, and have been asked to see if I can get this issue resolved via community. I’ll request on my side to be given rights to simulate our instance in a VM so I can test my theory. Doing what I can with what I’m allowed to use, so sorry I can’t offer more just yet.