AnyMemo icon indicating copy to clipboard operation
AnyMemo copied to clipboard

org.liberty.android.fantastischmemo.downloader.dropbox.DropboxDBListActivity may leak

Open mjblackhorse opened this issue 8 years ago • 3 comments

I found that org.liberty.android.fantastischmemo.downloader.dropbox.DropboxDBListActivity may leak if we rotate screen many times. As shown in the figure bellow, over 40 instances of org.liberty.android.fantastischmemo.downloader.dropbox.DropboxDBListActivity were found!

image

This might be caused by the fact that there were many AsynchroTasks waiting to be executed by the default SerialExecutor!

Maybe the "org.liberty.android.fantastischmemo.downloader.oauth.OauthAccessCodeRetrievalFragment$RequestTokenTask" should not be declared as an inner class.

mjblackhorse avatar Dec 06 '16 08:12 mjblackhorse

At the same time, instances of "org.liberty.android.fantastischmemo.downloader.google.SpreadsheetListScreen" also leaked with, maybe, the same reason:

image

The .hprof file (zipped with WinRAR, please change ".txt" to ".rar") is attached: heap_2.txt

mjblackhorse avatar Dec 06 '16 10:12 mjblackhorse

The async task should continue to execute until it is done. Once the async task is done, it should release the reference to the Activity. I still wonder why. Looks like RequestTokenTask is the key. I will investigate further. The Dropbox Activity is being re-written, so I will need to handle this correctly.

helloworld1 avatar Dec 07 '16 06:12 helloworld1

Similar situations happen to org.liberty.android.fantastischmemo.downloader.quizlet.QuizletSearchByTitleActivity

image

mjblackhorse avatar Dec 15 '16 07:12 mjblackhorse