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

iOS MapView unmount memory leak when using PROVIDER_GOOGLE #2775

Closed
zacharyweidenbach opened this issue Mar 29, 2019 · 4 comments
Closed

iOS MapView unmount memory leak when using PROVIDER_GOOGLE #2775

zacharyweidenbach opened this issue Mar 29, 2019 · 4 comments
Labels
bug Something isn't working

Comments

@zacharyweidenbach
Copy link

Is this a bug report?

Yes.

Have you read the Installation Instructions?

Yes

Environment

react-native: 0.59.2
react: 16.8.3
react-native-maps: github:react-native-community/react-native-maps#master

Target Platform: eg: iOS - iPhone 7 Plus with Google Maps

Steps to Reproduce

(Write your steps here:)

  1. Have component mounted that displays multiple MapView components using the PROVIDER_GOOGLE provider.
  2. Unmount and remount this component.
  3. Notice that after several remounts, entire app crashes.

Currently using a VirtualizedList component to render many MapViews

Expected Behavior

Unmounting and mounting components with MapView using the google provider will not eventually result in a crash.

Actual Behavior

Entire application crashes after unmounting and remounting a component with many MapViews using provider={PROVIDER_GOOGLE} prop. Observe the Xcode memory profiler to see memory growing after each mount. This leads me to believe there is some memory leak occurring.

Notice that when switching to the default provider (apple maps in this case), app no longer crashes.

@rborn rborn added bug Something isn't working Google Maps labels Mar 30, 2019
@rborn
Copy link
Collaborator

rborn commented Apr 1, 2019

@zacharyweidenbach hey, thanks for the report, could you please add more logs about this (screenshots etc?) 🤗

@zacharyweidenbach
Copy link
Author

zacharyweidenbach commented Apr 1, 2019

Screen Shot 2019-04-01 at 8 40 53 AM
Screen Shot 2019-04-01 at 8 41 00 AM

Each step in the graph corresponds to the mounting of a map component.

Here are the device logs around time of crash:

default	08:44:48.547022 -0700	locationd	#Warning Location connection invalid!
default	08:44:48.547095 -0700	locationd	{"msg":"CLConnection::handleDisconnection", "event":"activity"}
default	08:44:48.547118 -0700	locationd	Client com.testapp disconnected
default	08:44:48.547510 -0700	locationd	{"msg":"#CLIUA Marking change", "clientKey":"com.testapp", "reason":"In-use halo-effect", "assertionLevel":4, "coming":0}
default	08:44:48.547754 -0700	locationd	CLGyroBiasEstimator,SPUEnabled,0,BuildingGYTT,0,NumClients,0
default	08:44:48.547997 -0700	locationd	{"msg":"state transition", "event":"state_transition", "state":"DaemonClient", "id":"0x109716620", "property":"lifecycle", "old":"0x109716620", "new":"0x0"}
default	08:44:48.548314 -0700	backboardd	0x1000004f2: set report interval:0 client:<private>
default	08:44:48.548552 -0700	backboardd	0x1000004f2: set batch interval:10000 client:<private>
default	08:44:48.548928 -0700	locationd	{"msg":"#Stream Accuracy enablement assertion released", "client":"<CLIntersiloProxyToInitiator: peer silo:CLClientManagerSilo(CLClientManagementWorkloop), peer name:<REDACTED>>"}
default	08:44:48.609522 -0700	locationd	stopping accessory location
default	08:44:48.610525 -0700	locationd	@IndoorFlow, turnon, onClientRemoval, ActivityFitness
default	08:44:48.611468 -0700	locationd	ERROR - IAPLocationDeactivate failed.
default	08:44:48.611867 -0700	assertiond	[TestAppNative:14832] Port death watcher fired.
error	08:44:48.611896 -0700	symptomsd	Can't get most elevated app state from dictionary {
    BKSApplicationStateExtensionKey = 0;
    SBApplicationStateDisplayIDKey = "com.testapp";
    SBApplicationStateKey = 0;
    SBApplicationStateProcessIDKey = 14832;
    SBApplicationStateRunningReasonsKey =     (
                {
            SBApplicationStateRunningReasonAssertionIdentifierKey = Resume;
            SBApplicationStateRunningReasonAssertionReasonKey = 10000;
        },
                {
            SBApplicationStateRunningReasonAssertionIdentifierKey = "Shared Background Assertion 149 for com.testapp";
            SBApplicationStateRunningReasonAssertionReasonKey = 4;
        }
    );
}
default	08:44:48.611952 -0700	symptomsd	14832 com.testapp: Unknown (most elevated: Unknown)
default	08:44:48.612005 -0700	symptomsd	Entry, display name com.testapp uuid (null) pid 14832 isFront 0
default	08:44:48.612061 -0700	assertiond	Server invalidated <BKProcessAssertion: 0x10166c610; "Resume" (activation:inf); id:…227992383B4A>
default	08:44:48.612201 -0700	assertiond	Client relinquished <BKProcessAssertion: 0x10166c610; "Resume" (activation:inf); id:…227992383B4A>
default	08:44:48.612226 -0700	assertiond	[TestAppNative:14832] Ignoring assertion remove, because we are terminated or pending termination
default	08:44:48.612251 -0700	assertiond	Process exited: <BKProcess: 0x10166beb0; TestAppNative; com.testapp; pid: 14832; agency: Application; visibility: none; task: none; hostpid: 11680>
default	08:44:48.612276 -0700	assertiond	[TestAppNative:14832] Invalidating...
default	08:44:48.612386 -0700	WirelessRadioManagerd	{"msg":"CLCopyTechnologiesInUse", "event":"activity"}
default	08:44:48.612631 -0700	assertiond	Removed BKApplicationStateServerClient for [14828:<private>] -> <private>
default	08:44:48.613458 -0700	symptomsd	NBSM Current state: normal, changed: systemForeground to 0 for net type 0
default	08:44:48.613485 -0700	symptomsd	NBSM Eligible to go to broken
default	08:44:48.613566 -0700	aggregated	{"msg":"CLCopyTechnologiesInUse", "event":"activity"}
default	08:44:48.613595 -0700	symptomsd	NBSM Current state: normal, changed: systemForeground to 0 for net type 0, eligible for broken but constraints unsatisfied (0,0)
default	08:44:48.613646 -0700	symptomsd	Continue with bundle name com.testapp, is front 0
default	08:44:48.613671 -0700	symptomsd	com.testapp: Foreground: false
default	08:44:48.613750 -0700	symptomsd	call _saveAndUnloadSelectState
default	08:44:48.614449 -0700	aggregated	{"msg":"CLCopyAppsUsingLocation", "event":"activity"}
default	08:44:48.617083 -0700	assertiond	Removed BKApplicationStateServerClient for [14829:<private>] -> <private>
default	08:44:48.730918 -0700	apsd	__dumpLogsForInconsistencyIfNecessary - lastBecameInconsistentTime 0.000000  sBecameInconsistentTime 0.000000  logDumpReason (null)
default	08:44:48.810317 -0700	assertiond	[TestAppNative:14832] Got exit context: <BKSProcessExitContext: 0x10166ccc0; reason: jetsam>
default	08:44:48.810523 -0700	SpringBoard	<FBApplicationProcess: 0x1153b2710; TestAppNative (com.testapp); pid: 14832> assertiond says the process actually exited with context: <BKSProcessExitContext: 0x280b79590; reason: jetsam>
default	08:44:48.810833 -0700	SpringBoard	<FBApplicationProcess: 0x1153b2710; TestAppNative (com.testapp); pid: 14832> was killed by jetsam.
default	08:44:48.811721 -0700	SpringBoard	Removing: <FBApplicationProcess: 0x1153b2710; TestAppNative (com.testapp); pid: 14832>

Also, a correction on my original post. The detail of maps being mounted in a virtualized list seems to be irrelevant. Although the unmounting and remounting of many MapView components seems to exacerbate the issue, and precipitate a crash faster. However, the mounting and unmounting of a single MapView component can eventually lead to a crash with enough remounting react lifecycles.

@christopherdro
Copy link
Collaborator

I just published 0.24.1 with the following commit(90e4a6e) that should resolve the memory leak issue. Can you guys test and confirm?

@christopherdro
Copy link
Collaborator

Continuing conversation in #2782

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants