Вопрос

Sounds like a stupid question, but I can't think of any possible way to do it.

Ideally, I would like to check for memory leaks with suspicious Activities / Services that were onDestroy' ed, but seem to be in RAM.

Это было полезно?

Решение

You can create WeakReference to your activity. Be careful and do not keep any hard/soft references. Call GC (e.g. from another activiy) and check if reference is null or not. Keep in mind that android can keep activity in memory to reuse it.

You can use finalize method for debug purpose. You must not use it in Release version and remove it.

Also you can use MAT as @Simon suggested to see all Objects of your application.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top