How to manage memory/cache from code?
My app is crashing after longer use - runs开发者_如何学运维 out of memory. I am closing all activities after switching to next one, but I still have that problem.
Is it possible to programmatically clear cache / memory, so application does not run out resources? Can I use getCacheDir() to accomplish that?Apparently your app is leaking memory. Make sure you clean up unused resources, close databases, reuse variables, etc.
Also refer to this post on how to track down memory leaks and how to avoid them.
精彩评论