question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nativescript Mapbox on iOS retain memory after navigation away

See original GitHub issue

I’m using Angular 2, with router-outlet navigation. My app is killed by the OS for using too much memory after I navigate away from the page with the MapBox map and return. It’s clear that the memory associated with the Mapbox instance is not being released.

I put a log statement in ngOnDestroy() and it is being called when I expect it to be. Is there anything I can do to force the SDK to release memory?

I’m instantiating the map via XML


    <GridLayout  #mapcontentview  rows="*" columns="*" >
        <Mapbox
            accessToken=MYTOKEN
            latitude="39.9780"
            longitude="-82.4182"
            zoomLevel="12"
            showUserLocation="true"
            (mapReady)="onMapReady($event)">
        </Mapbox>
     </GridLayout>

This component is instantiated in the page via Angular2 router-outlet navigation.

How can I further debug this issue?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:27

github_iconTop GitHub Comments

1reaction
EddyVerbruggencommented, May 7, 2018

Thanks for sharing, @simonettoa!

I’m about to release plugin version 4.0.0 which includes Mapbox iOS SDK version 4.0.0 which (as far as I can see from their changelog) contains a bunch of memory leaks. Perhaps that will help as well. Closing for now.

1reaction
ahallscommented, Apr 1, 2017

With the above referenced test app.

I do a GC on ngInit … I’m loosing only 5MB on a round trip. This is a big improvement over ~350MB I was loosing.

It is probably good enough for our application. But not for a full scale (web scale) production app.

I don’t think you should close this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reduce Memory Usage Reference - Mapbox docs
Then, the user initiates navigation and the NavigationViewController is presented. However, the preview map is longer necessary to keep around in memory.
Read more >
nativescript-mapbox/mapbox.ios.ts at master - GitHub
// tried to init the map. private initCountHack : number = 50;.
Read more >
ios - Memory get increase but not release on dismiss [Mapbox]
I am using MapBox for navigation in my app. ... At this moment my memory get increase 180mb, after get dismiss from controller...
Read more >
Using A Mapbox In A NativeScript Angular Application
We're going to see how to include Mapbox in our NativeScript Android and iOS mobile application using Angular and TypeScript.
Read more >
nativescript-mapbox
$ npm install --save nativescript-mapbox · cd src npm run build. · cd src npm run build. · <service android:name="com.mapbox. · <Page xmlns="http://schemas....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found