kotlin 改造-背景粘性并发标记扫描 GC 释放 65326(1448KB) 分配空间对象,62(1736KB) L



我正在尝试使用 kotlin 中的 Retrofit 发出一个简单的 REST 请求,但我收到了很多 GC 错误。我真的不知道如何解决它。我试图在模拟器上放置更多内存,但问题仍然存在。

我的代码是:

    val retrofit =Retrofit.Builder().baseUrl("Url")   
      .addConverterFactory(GsonConverterFactory.create()) 
      .build()
    val retrofitAPI = retrofit.create(ApiServices::class.java) 
    val call = retrofitAPI.getBarcharts(dashboardRequestBean)  
    call.enqueue(object : Callback<ResponseChartModel<BaseChartModel>> {
        override fun onResponse(call: Call<ResponseChartModel<BaseChartModel>>? , response: Response<ResponseChartModel<BaseChartModel>>?) {
            TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
        }
        override fun onFailure(call: Call<ResponseChartModel<BaseChartModel>>?, t: Throwable?) {
            Toast.makeText(this@MainActivity, t?.message, Toast.LENGTH_SHORT).show()
        }
    })

接口 API 服务

  @POST("getDashlet")fun getBarcharts(@Body dashboardRequestBean: DashboardRequestBean): Call<ResponseChartModel<BaseChartModel>>

例外:

 FinalizerDaemon: finalize objects = 216
 06-15 09:16:14.928 6920-6931/ssa.abc.alrais.kotlindemo I/art: 
 Background sticky concurrent mark sweep GC freed 65326(1448KB) 
 AllocSpace objects, 62(1736KB) LOS objects, 36% free, 4MB/7MB, paused 
 5.406ms total 36.953ms
 06-15 09:16:15.118 6920-6931/ssa.abc.alrais.kotlindemo I/art: 
 Background partial concurrent mark sweep GC freed 69034(1527KB) 
 AllocSpace objects, 72(2008KB) LOS objects, 39% free, 5MB/8MB, paused 
 5.698ms total 65.069ms
 06-15 09:16:15.340 6920-6931/ssa.abc.alrais.kotlindemo I/art: 
 Background sticky concurrent mark sweep GC freed 75548(1650KB) 
 AllocSpace objects, 70(1960KB) LOS objects, 36% free, 5MB/8MB, paused 
 6.638ms total 49.777ms
 06-15 09:16:15.559 6920-6931/ssa.abc.alrais.kotlindemo I/art: 
 Background partial concurrent mark sweep GC freed 79831(1715KB) 
 AllocSpace objects, 71(2MB) LOS objects, 40% free, 5MB/9MB, paused 
6.345ms total 75.652ms

android.app.LauncherActivity.ListItem 用于 显示可以为给定意图执行的所有活动的列表。单击时启动。

因此,请检查您的列表项 bean 包。

最新更新