1

MapView 버전을 사용하고 있습니다. 10.0.1. 메모리 누수가 발생했습니다. MapView는 활동 컨텍스트를 보유하고 있습니다.
LeakCanary 추적 :MapView 유지 컨텍스트 메모리 누수 원인

com.demo.app.ui.main.MainActivity has leaked: 
GC ROOT wl.a 
references oo.a 
references maps.ad.L.g 
references maps.ad.V.c 
references maps.D.i.a 
references maps.D.p.mParent 
references android.widget.FrameLayout.mParent 
references com.google.android.gms.maps.MapView.mContext 
leaks com.demo.app.ui.main.MainActivity instance 

답변

2

누출은 대부분 (당신이 경우 설정) 사용자의 현재 위치를 추적하기 위해 계속 구글지도에서오고있다. 다음을 onDestroy()에 추가하십시오.

@Override 
public void onDestroy() { 

    if (mMapView != null) { 
     mMapView.onDestroy(); 
    } 

    //Clean up resources from google map to prevent memory leaks. 
    //Stop tracking current location 
    if(mGoogleMap != null) { 
     mGoogleMap.setMyLocationEnabled(false); 
    } 
    super.onDestroy(); 
}