What to do on TransactionTooLargeException

前端 未结 30 3336
盖世英雄少女心
盖世英雄少女心 2020-11-22 03:08

I got a TransactionTooLargeException. Not reproducible. In the docs it says

The Binder transaction failed because it was too large.

D

30条回答
  •  -上瘾入骨i
    2020-11-22 03:23

    Recently I also have encountered with an interesting case while working with Android's Contacts Provider.

    I needed to load photos of contacts from internal contacts database and according to the system architecture all of this data are delivered by queries to Contacts Provider.

    As it works as a separate application - all kinds of data transferring are performed by using Binder mechanism and so Binder buffer comes into play here.

    My main mistake was that I didn't close the Cursor with blob data gotten from Contacts Provider, so that the memory allocated for the provider increased and this inflated the Binder buffer until I got tons of !!!FAILED BINDER TRANSACTION!!! messages in my LogCat output.

    So the main idea is that when you work with external Content Providers and got Cursors from them, always close it when you finish to work with them.

提交回复
热议问题