开发者

Does app could cause phone reboot and how to release variable

I write an app which will continuously request data from a sensor board and send data to server. I use a Motorola Droid phone which开发者_StackOverflow社区 have not be activated to test my app. I find that sometimes after several hours the phone will reboot. I just want to know does it cause by my app run out of memory. And if an app runs out of phone's memory, should just the app be force closed or the phone be reboot?

If this causes by app running out of memory how could I release and clear variables. Should the system automatically do this? I think the main problem might be that I set a global json variable to receive and send all data. After sending the data, I just user new JSONObject() to initiate the variable. I just want to know does the old one will be released automatically? If not, how can I do to release it?

Thanks


If an app runs out of phone's memory, an exception will be thrown and if the exception will not be catched - an app will be force closed.

System automatically clean unused memory. Yes, your old JSONObject should be autoreleased by garbage collector.

To learn how to find memory leaks in Android programs, read the article in Android developers blog: Memory Analysis for Android Applications

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜