Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak #70

Open
yzhbankov opened this issue Jun 18, 2018 · 3 comments
Open

Memory leak #70

yzhbankov opened this issue Jun 18, 2018 · 3 comments

Comments

@yzhbankov
Copy link

Found big problem for us. When using this library observer memory leak. After couple minutes of working increased javascript memory usage. For 20-30 minutes in increased up to 6-7 times.

@popbee
Copy link

popbee commented Aug 10, 2018

Could the memory leak be because because all registered events are never unregistered?

    Object.entries(clusterEvents).forEach(
      ([eventAsProp, callback]) => {
        const clusterEvent = `cluster${eventAsProp.substring(2).toLowerCase()}`;
        markerClusterGroup.on(clusterEvent, callback);
      }
    );```

@ivanov-v
Copy link

@yuzhva Is this bug planned to be fixed?

@ronaldaraujo
Copy link

I've been same error here. In my scenery, I have two functions:

function renderStaticMap() {
    return showClusterGroup ? (
        <MarkerClusterGroup>{renderMarkers()}</MarkerClusterGroup>
    ) : (
        renderMarkers()
    );
}

and

function renderMarkers() {
    return equipments?.map((equipment, index) => {
      const [lat, lng] = getLatLngFromEquipment(equipment);

      return (
        lat &&
        lng && (
          <Marker
            key={index}
            position={{
              lat,
              lng
            }}
            icon={getIcon(equipment)}
          >
            <Popup
              onClose={() => {
                openMapHeader();
              }}
              onOpen={() => {
                closeMapHeader();
                if (showClusterGroup) setShowClusterGroup(false);
              }}
            >
              <Card data={equipment} />
            </Popup>
          </Marker>
        )
      );
    });
}

When property showClusterGroup is false, the map is rendered normally. But showClusterGroup is true the application freeze.

What am I doing wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants