Android, detect open cursors in whole project
Asked Answered
L

1

5

How to find cursors that are not closed in whole project that may cause memory leaks and other problems since Android lint warns them now?

Luster answered 4/5, 2016 at 5:30 Comment(3)
add log on everywhere you open and close a cursor. check if the open and close present in pair in you logcatParticipation
My app has more than 150 classes and many places to use cursor, the first way I think about was search key word cursor and then check it, but it is too slow to do so. Thanks.Luster
root a device, hook the cursor opening API with xposed to log outParticipation
L
10

Finally I found the way!

from top menu: Analyze>Inspect code then whole project and OK

Now wait till Android studio finds lint problems in your app, then go to the below item and check if the not recycled item is Cursor, also you can use it for other resources that are open but not closed!

Android > Lint > Performance then Missing recycle() calls

Luster answered 18/5, 2016 at 6:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.