簡體   English   中英

Memory 分配 - UI 卡住/掛起 - 網絡調用 (Rx2AndroidNetworking) 和在 SQLite (ActiveAndroid) 中插入記錄

[英]Memory Allocation - UI Stucks/Hangs - While Network Call (Rx2AndroidNetworking)& Inserting Records In SQLite(ActiveAndroid)

I am using Rx2AndroidNetworking in my project to get getObjectListObservable thousands of records from the Server JSON List of Objects about 150+ attributes of SQLite Database of 3 Tables which i have to resync(Insert) the data to SQLite tables using ActiveAndroid ORM.

在執行Rx2AndroidNetworking.get方法時,logcat 中會顯示以下日志。

D/LoginActivity: onCompleted: only_login
D/LoginActivity: onComplete: before_executing_the_resyncing_code
D/LoginActivity: InsertData: before_Rx2AndroidNetworking_GetPatients
I/art: Do partial code cache collection, code=57KB, data=58KB
I/art: After code cache collection, code=56KB, data=57KB
I/art: Increasing code cache capacity to 256KB
I/art: Background sticky concurrent mark sweep GC freed 12747(2MB) AllocSpace objects, 0(0B) LOS objects, 11% free, 17MB/19MB, paused 12.598ms total 37.164ms

在執行public void onNext方法時,logcat 中會顯示以下日志。

D/LoginActivity: onNext: resyncing_insert_data_in db
I/art: Do full code cache collection, code=125KB, data=101KB
I/art: Starting a blocking GC JitCodeCache
I/art: After code cache collection, code=69KB, data=44KB
I/art: Do partial code cache collection, code=81KB, data=80KB
I/art: After code cache collection, code=80KB, data=80KB
I/art: Increasing code cache capacity to 512KB
I/art: Compiler allocated 6MB to compile void .onNext(java.util.List)
I/art: Compiler allocated 8MB to compile void .onNext(java.util.List)

在執行網絡調用並在 SQLite 中插入數據時,我的應用程序的 UI 卡住了。 我的應用程序想要從操作系統獲取 Memory,但設備(具有 3 GB RAM 的聯想 TB-X704L)無法為我的應用程序分配超過 64 MB 的 memory(特此附上屏幕截圖)。

在此處輸入圖像描述

診斷問題並提出解決方案。

您在哪個線程上執行 sql 操作? 嘗試在單獨的工作線程上移動 sql 操作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM