开发者

iOS NSZombiesEnabled = YES

I found this bit of code online to check if my NSZombiesEnabled is on or off

if( getenv("NSZombieEnabled") || getenv("NSAutoreleaseFreedObjectCheckEnabled") ) {
    NSLog(@"NSZombieEnabled/NSAutoreleaseFreedObjectCheckEnabled enabled!");
}

The strange thing is that if in my env. variables in XCode4 I set NSZombiesEnabled = NO then the code still shows it to be set. Only if I completely remove the setting does it not show.

I believe NSZombiesEnabled creates one gaping memory leak so I want to be sure that just setting the env. variable to开发者_开发百科 NO also disables it.

Cheers Nick


Setting the variable to "NO", doesn't disable it — it just sets the variable to "NO" and the framework checks the value itself. You have to check if it's equal to the string "NO". The if-statement doesn't check if a value says "no", it checks if the value is empty, nil, NULL, zero, etc.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜