Skip to content
This repository was archived by the owner on Sep 20, 2019. It is now read-only.
This repository was archived by the owner on Sep 20, 2019. It is now read-only.

Memory leak caused by leafletControlHelpers.updateLayersControl #279

@apkoponen

Description

@apkoponen

Hi,

I'm using the directive to show markers on maps that all have a different ID. There seems to however be a memory leak in leafletControlHelpers, which is caused by _controls[mapId] holding a reference to map data, which is not destroyed when the directive gets destroyed.

I was able to get rid of the memory leak by changing the line https://github.com/angular-ui/ui-leaflet/blob/master/src/services/leafletControlHelpers.js#L162
to

            var _layersControl = _controls[mapId];
            _controls = {};
            _controls[mapId] = _layersControl;

which removes all but the current references from the _controls object.

This is not a suitable workaround though, because it essentially prevents having multiple directives running at the same time. Do you have any suggestions as to how to remove the reference when the map with the corresponding mapId is destroyed?

A-P

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions