hoffimar / timerdroid

timerdroid android app
GNU General Public License v3.0
11 stars 5 forks source link

Activity & Fragment Leaks #15

Open mjblackhorse opened 7 years ago

mjblackhorse commented 7 years ago

We recently developed an tool for detecting leaking Activity and Fragments. The tool would try to rotate the screen ones an action is performed. It would also try to press "Back" if an new Activity is launched via action act_i, after which it would re-perform act_i.

We applied it to the app, and found that "com.tomatodev.timerdroid.activities.MainActivity" "com.tomatodev.timerdroid.activities.TimerActivity" and "com.tomatodev.timerdroid.fragments.RunningTimersFragment" leaked(they were destroyed but Cannot be freed by GC). image

I am not allowed to upload the full testing result (a .zip file), I don't know why! So I changed the file name from "results.zip" to "results.txt" as follows. Results.txt The file consists of many html files, and the entry file is index.html.

Here attached the logcat log: GenerelLogCatLogs.txt

P.S. during the execution, the app crashed 4 times. I could provide the dumped .hropf files as well as the result in full if needed!

mjblackhorse commented 7 years ago

I think I've found the cause: RunningTimersFragment forgot to unbind the service it binds in "onActivityCreated()"

besides: RunningTimersFragment would bind the same service twice with different serviceConnection instances, one is created in "onActivityCreated()", another one is created in "fillFavorites()“

mjblackhorse commented 7 years ago

similar problem happens to ListTimersActivity, TimerActivity, CategoriesFragment, ListTimersFragment and TimerFragment