阅读背景:

在Objective C中检查内存分配的正确方法

来源:互联网 

I'm wondering what would be the correct approach after executing a command that allocates memory in Objective C (I'm mainly referring to iOS apps). My dilemma comes from the fact that checking for the success of failure of a memory allocation operation adds lots of lines of code, while wondering whether this is at all useful. Moreover, sometimes memory allocations are obvious, such as using 'alloc', but sometimes they are taking place behind the scenes. And even if we check each and every allocation - when we find it failed - there isn't much we could actually do. So maybe the correct approach is to just let it fail and have the app crash? Take a look at this code:I'm wondering what would be the correct approac




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: