1

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

Constantino Tsarouhas
  • 6,846
  • 6
  • 43
  • 54
Nick
  • 205
  • 3
  • 14

1 Answers1

3

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.

Constantino Tsarouhas
  • 6,846
  • 6
  • 43
  • 54