hasnain_ahmad
hasnain_ahmad

Reputation: 365

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.

While executing the Rx2AndroidNetworking.get method the following logs are showing in the 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

While executing the public void onNext method the following logs are showing in the 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)

While executing network call and inserting the data in the SQLite the UI of my App is stucks. My app wants to get Memory from the OS but the device (Lenovo TB-X704L having 3 GB RAM) unable to allocate more than of 64 MB of memory to my app(screenshot is attached hereby).

enter image description here

Diagnose the issue and suggest the solution.

Upvotes: 2

Views: 282

Answers (1)

Zohaib Akram
Zohaib Akram

Reputation: 627

On which thread you are doing sql operation? Try to move sql operation on separate worker thread.

Upvotes: 0

Related Questions