Native memory usage keep increasing when activity is recreated

2110
1
Jump to solution
01-31-2018 09:55 AM
PatrickBolduc
New Contributor II

I was playing with the samples available on Github (GitHub - Esri/arcgis-runtime-samples-android: ArcGIS Runtime SDK for Android Samples ) and while profiling one of the application, I observed that the native memory usage increases everytime I rotate the device (about 10Mb every rotation) as shown in the screenshot below.

raster-image-file-profiling

I profiled two (raster-layer-file and raster-layer-service)applications available in the samples repository and the issue was reproductable in both of them.

The issue is reproductable in runtime100.1 and 100.2.

Regards,

Patrick

0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable

Hi Patrick,

Thanks for your post and for catching this memory leak!

The issue is to do with not disposing of the MapView on device rotation, which can best be handled in Android's @onDestroy callback as per:

@Override 
protected void onDestroy() {
    super.onDestroy();
    mMapView.dispose();
}

These samples will be updated accordingly!

Kind regards,

Trevor

View solution in original post

1 Reply
by Anonymous User
Not applicable

Hi Patrick,

Thanks for your post and for catching this memory leak!

The issue is to do with not disposing of the MapView on device rotation, which can best be handled in Android's @onDestroy callback as per:

@Override 
protected void onDestroy() {
    super.onDestroy();
    mMapView.dispose();
}

These samples will be updated accordingly!

Kind regards,

Trevor