RPC on android causes GC_EXPLICIT

喜夏-厌秋 提交于 2019-12-12 06:29:42

问题


I need to synchronize my local sqlite database with a remote mysql database. I'm testing different XMLRPC and JSONRPC projects to do so.

I send a packet containing all entries that arn't synced yet for each table.

When these RPC projects are parsing the data logcat is filled with GC_EXPLICIT.

GC_EXPLICIT means that the garbage collector has been explicitly asked to collect, instead of being triggered by high water marks in the heap. Happens all over the place, but most likely when a thread is being killed or when a binder communication is taken down. ~ Robert

I tried to modify a XMLRPC project to perform my desired actions right after an entry is read from the packet and then use the same object variable to instantiate the next entry.

This however does not solve the collect requests to the garbage collector.

Any idea? tips? suggestions?


回答1:


I solved my problem a couple days ago.

I'm using the Android JSON RPC module made by Alex (project).

I removed the part where the module parses the JSON. And created my own parse routine using regex. The module also performs SQLite query's instead of creating JSON objects.

Another thing I changed is that the module will accept and receive multiple packets with a maximum of 1000 entries.

The code is extreemly fast, it took 30 minutes to synchronize 3000 entries, now it only takes 3 minutes. The reason why I'm posting this information instead of the code is because the code is very project specific.

Information about how to loop and why not to allocate over 1000 objects is described in the android performance document.



来源:https://stackoverflow.com/questions/5716346/rpc-on-android-causes-gc-explicit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!