maps icon indicating copy to clipboard operation
maps copied to clipboard

[Bug]: Memory Leak Issue

Open KristofferEriksson opened this issue 3 years ago • 7 comments

Mapbox Implementation

Mapbox

Mapbox Version

default

Platform

iOS, Android

@rnmapbox/maps version

#main

Standalone component to reproduce

import React from 'react';
import {
  MapView,
  ShapeSource,
  LineLayer,
  Camera,
} from '@rnmapbox/maps';

const aLine = {
  type: 'LineString',
  coordinates: [
    [-74.00597, 40.71427],
    [-74.00697, 40.71527],
  ],
};

class BugReportExample extends React.Component {
  render() {
    return (
      <MapView style={{flex: 1}}>
        <Camera centerCoordinate={[-74.00597, 40.71427]} zoomLevel={14} />
        <ShapeSource id="idStreetLayer" shape={aLine}>
          <LineLayer id="idStreetLayer" />
        </ShapeSource>
      </MapView>
    );
  }
}

Observed behavior and steps to reproduce

When navigating to a screen with a map and then navigating back or to another screen, the map does not unload properly. Every time we're loading a screen with a map in it, the memory adds up until it causes a memory exhaustion crash. This occurs both on iOS and on Android.

Skærmbillede 2023-02-07 kl  14 40 33

Expected behavior

No response

Notes / preliminary analysis

No response

Additional links and references

No response

KristofferEriksson avatar Feb 07 '23 13:02 KristofferEriksson

Same issue on my project

thibaultitautomotive avatar Feb 08 '23 09:02 thibaultitautomotive

I also have this issue.

bradstiff avatar Feb 14 '23 22:02 bradstiff

@KristofferEriksson I've tried on current master, one with 10.11 as mapbox dependency. And It was working me just fine. I've replace BugReportExample.js with the code you've pasted bellow and then opened closed the BugReportTemplate example.

image

mfazekas avatar Feb 15 '23 13:02 mfazekas

I'm closing this as I cannot reproduce. Please try with latest version and please describe how to reproduce in our example app.

mfazekas avatar Feb 15 '23 13:02 mfazekas

@mfazekas @KristofferEriksson

This is still an issue on Android. Attached is a graph of how the memory use climbs when mounting and unmounting the BugReportExample screen 18 times. I made sure to signal a GC before stopping the recording, as you can see along the bottom.

image

I'm using 10.0.0-beta.76 with the default mapbox version.

bradstiff avatar Mar 14 '23 19:03 bradstiff

@bradstiff added a fix for that - #2707

mfazekas avatar Mar 16 '23 06:03 mfazekas

Beautiful. Looking forward to the release!

On Thu, Mar 16, 2023, 12:22 AM Miklós Fazekas @.***> wrote:

@bradstiff https://github.com/bradstiff added a fix for that - #2707 https://github.com/rnmapbox/maps/pull/2707

— Reply to this email directly, view it on GitHub https://github.com/rnmapbox/maps/issues/2591#issuecomment-1471387855, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEDU6IMCJ32XCO3JPPNDK3DW4KWS7ANCNFSM6AAAAAAUVBHQI4 . You are receiving this because you were mentioned.Message ID: @.***>

bradstiff avatar Mar 16 '23 14:03 bradstiff