title: Understanding Memory management with NSDictionary release
body: <p>iOS memory management is still something weird to understand to me but that's the most interesting aspect to me also, so I'm asking for some help here with my code. </p>
  
  <p>I try to instantiate a NSDictionary object, I use it then I'd like to release but I got an object released error, this is the code:</p>
  
  <pre><code>if ([jsonArray count] &gt; 0) {        
      NSDictionary *commentDictionary = [[NSDictionary alloc]init];
      int i;
      for (i = 0; i &lt; [jsonArray count]; i++) {
          commentDictionary = [jsonArray objectAtIndex:i];
          NSLog(@"debugging message here"]);
          commentLabel.text = [commentDictionary objectForKey:@"commentText"];
          //[commentDictionary retain];
      }
      //[commentDictionary release];
      commentDictionary = nil;
      NSLog(@"NSDictionary retainCount = %d",[commentDictionary retainCount]);
  }
  </code></pre>
  
  <p>Nothing special, I fill a dictionary from an array, in my code you can see I tried to release but than I commented out because of the error. 
  Why I can't release the dictionary?</p>
  
  <p>Besides what's the difference between setting NSDictionary to nil that returns zero in retainCount and release (that should make the count -1)?</p>
  
  <p>I thank you very much in advance for any kind of help in this topic.</p>
  
  <p>Fabrizio</p>