[英]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.