如果内存不足 [英] Incase of insufficient memory

查看:96
本文介绍了如果内存不足的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已阅读如果内存不足,新操作符将引发异常.
所以我的问题在这里....
我们是否应该总是在try ..... catch块内创建一个对象?

如果不是,那么在这种情况下如何防止崩溃?

I have read Incase of insufficient memory new operator throws exception.
So my question is here....
Should we always creat an object inside try .....catch block?

if not then how can prevent to crash in this case?

推荐答案

您的应用程序应具有异常处理功能,以确保它确实崩溃.您应该至少在一个很高的级别上有一个try catch块,但是我认为每个新"的try catch都太多了.
Your application should have exception handling to make sure that it does crash nicely. You should have at least a try catch block on a very high level, but a try catch for every "new" is far too much in my opinion.


这篇关于如果内存不足的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆