title: Objective-C: Why is this a memory leak?
body: <p>I am getting a memory leak in my objective-C code that I don't understand. I have this code in a method that gets called several times:</p>
  
  <pre><code>AnalyzeBpm *analyzer  = [[AnalyzeBpm alloc] init];  
  
  while( sample != NULL)
  {
  //do something with analyzer
  }
  
  [analyzer release];
  </code></pre>
  
  <p>When I run this code through Instruments, I get a leak everytime I allocate Analyze Bpm(which is a couple of hundred times). I looked at my AnalyzeBpm class, and everything I allocate in that class gets freed or deallocated. So why is this code creating a memory leak?</p>