后台粘性并发标记清除GC已释放且应用程序崩溃-Android

Sab*_*ish 6 android android-fragments

将一些数据发送到服务器时,以下方法会产生更多的影响,

I/art? Background sticky concurrent mark sweep GC freed 45388(3MB) AllocSpace objects, 17(292KB) LOS objects, 14% free, 10MB/11MB, paused 20.543ms total 209.212ms
I/art? Background partial concurrent mark sweep GC freed 66026(4MB) AllocSpace objects, 27(616KB) LOS objects, 28% free, 9MB/13MB, paused 2.454ms total 246.055ms
I/art? Background sticky concurrent mark sweep GC freed 42923(3MB) AllocSpace objects, 14(236KB) LOS objects, 20% free, 11MB/13MB, paused 3.247ms total 143.983ms
W/art? Suspending all threads took: 7.054ms
Run Code Online (Sandbox Code Playgroud)

MyClass.Java

private static synchronized void saveToServer(final MyClass myclass) throws JSONException {
User currentUser = MainActivity.getUser();
HashMap<String, Object> params = new HashMap<String, Object>();
params.put(“name”, myclass.getname());
// …. other params.put(....)
try {
HttpClientUtils.postRequestWithCallback(SAVE_URL, params, SignatureType.SIG_SEC, new HttpClientUtils.CustomCallbackListener(){
@Override
public void onSuccess(JSONObject jsonObject) {
myclass.setSaved(true);
}
});
}catch (Exception e){
}
}
Run Code Online (Sandbox Code Playgroud)