我的申请冻结了

时间:2017-12-01 08:48:50

标签: android memory-management garbage-collection android-anr-dialog

我正在为指纹识别器开发一个Android应用程序,我的操作包括验证用户指纹(连续),以及注册新指纹(从Web API获取指纹)。 我正在使用Morpho MSO 1300指纹识别器。

当我运行我的应用程序时,我不断收到跟踪logcat消息

  

01-02 11:19:48.910 5286-11417 / com.cms.attendance D / dalvikvm:   GC_FOR_ALLOC释放293K,20%免费3633K / 4540K,暂停14ms,总计14ms   01-02 11:19:49.350 5286-11417 / com.cms.attendance D / dalvikvm:   GC_FOR_ALLOC释放295K,20%免费3633K / 4540K,暂停14ms,总计14ms   01-02 11:19:49.770 5286-11417 / com.cms.attendance D / dalvikvm:   GC_FOR_ALLOC释放293K,20%免费3633K / 4540K,暂停14ms,总计14ms   01-02 11:19:50.210 5286-11417 / com.cms.attendance D / dalvikvm:   GC_FOR_ALLOC释放295K,20%免费3633K / 4540K,暂停14ms,总计14ms   01-02 11:19:50.630 5286-11417 / com.cms.attendance D / dalvikvm:   GC_FOR_ALLOC释放293K,20%免费3633K / 4540K,暂停14ms,总计14ms   01-02 11:19:51.070 5286-11417 / com.cms.attendance D / dalvikvm:   GC_FOR_ALLOC释放293K,20%免费3633K / 4540K,暂停14ms,总计14ms   01-02 11:19:51.570 5286-11417 / com.cms.attendance D / dalvikvm:   GC_FOR_ALLOC释放295K,20%免费3633K / 4540K,暂停14ms,总计14ms   01-02 11:19:52.070 5286-11417 / com.cms.attendance D / dalvikvm:   GC_FOR_ALLOC释放293K,20%免费3633K / 4540K,暂停14ms,总计14ms   01-02 11:19:52.570 5286-11417 / com.cms.attendance D / dalvikvm:   GC_FOR_ALLOC释放295K,20%免费3633K / 4540K,暂停14ms,总计14ms   01-02 11:19:53.000 5286-11417 / com.cms.attendance D / dalvikvm:   GC_FOR_ALLOC释放293K,20%免费3633K / 4540K,暂停14ms,总计14ms   01-02 11:19:53.500 5286-11417 / com.cms.attendance D / dalvikvm:   GC_FOR_ALLOC释放295K,20%免费3633K / 4540K,暂停14ms,总计14ms   01-02 11:19:53.930 5286-11417 / com.cms.attendance D / dalvikvm:   GC_FOR_ALLOC释放293K,20%免费3633K / 4540K,暂停14ms,总计14ms   01-02 11:19:54.360 5286-11417 / com.cms.attendance D / dalvikvm:   GC_FOR_ALLOC释放295K,20%免费3633K / 4540K,暂停14ms,总计14ms   01-02 11:19:54.800 5286-11417 / com.cms.attendance D / dalvikvm:   GC_FOR_ALLOC释放293K,20%免费3633K / 4540K,暂停14ms,总计14ms   01-02 11:19:55.300 5286-11417 / com.cms.attendance D / dalvikvm:   GC_FOR_ALLOC释放336K,20%免费3652K / 4540K,暂停14ms,总计14ms   01-02 11:19:55.730 5286-11417 / com.cms.attendance D / dalvikvm:   GC_FOR_ALLOC释放301K,20%免费3644K / 4540K,暂停14ms,总计14ms   01-02 11:19:56.150 5286-11417 / com.cms.attendance D / dalvikvm:   GC_FOR_ALLOC释放295K,20%免费3644K / 4540K,暂停15ms,总计15ms   01-02 11:19:56.600 5286-11417 / com.cms.attendance D / dalvikvm:   GC_FOR_ALLOC释放293K,20%免费3644K / 4540K,暂停14ms,总计14ms   01-02 11:19:57.010 5286-11417 / com.cms.attendance D / dalvikvm:   GC_FOR_ALLOC释放293K,20%免费3644K / 4540K,暂停14ms,总计14ms   01-02 11:19:57.440 5286-11417 / com.cms.attendance D / dalvikvm:   GC_FOR_ALLOC释放295K,20%免费3644K / 4540K,暂停14ms,总计14ms   01-02 11:19:57.880 5286-11417 / com.cms.attendance D / dalvikvm:   GC_FOR_ALLOC释放293K,20%免费3644K / 4540K,暂停14ms,总计14ms   01-02 11:19:58.030 24732-24776 / com.baidu.video.pad:下载V / P2PBase:   [11:19:58:040] [P2PBase] dns:media.p2sp.baidu.com解析失败。   等待3

当我在应用程序中增加数据时,说我从Web API获得了1000个用户,我尝试处理它们并在指纹识别器和sqlite数据库中注册它们,最终我的应用程序冻结了。

任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

此日志表示垃圾收集器刚刚释放内存。您正在进行大量分配,这就是GC必须经常工作的原因。

我建议您使用Android Profiler(Android Studio 3.0)并尝试解决此问题:https://developer.android.com/studio/profile/memory-profiler.html 或者过去你的代码,以便我们可以一起思考。