How to cause onLowMemory on device for tests

佐手、 提交于 2019-12-10 04:17:08

问题


I want to test our app for low memory cases.

Do you have any ideas, how to cause onLowMemory on devices?

Thank you.


回答1:


I just know only one way to do, which is to create a method running in a different thread that does memory leak, make it loop continuously until onLowMemory() is called, then stop the thread.

It's nice if anyone shares experiences on this case!



来源:https://stackoverflow.com/questions/7673516/how-to-cause-onlowmemory-on-device-for-tests

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!