title: My code either leaks and works, or doesn't leak and crashes. This doesn't seem like an autorelease problem
body: <p>After I finished coding the difficult parts of my game, I found some memory management bugs. </p>
  
  <p>objects is a NSMutableArray holding a custom class. </p>
  
  <pre><code>- (void) spawnObjects
  {   
      for (int index = 0; index &lt; INITIAL_OBJECTS; index++)
      {
          [objects addObject:[[[MatchObject alloc] initWithImageNameID:(index % 3)] autorelease]];
          [[objects objectAtIndex:index] setPosition:[GameLayer randomPoint]];
      }
  
      ...
  }
  </code></pre>
  
  <p>I later use this function.</p>
  
  <pre><code>- (void) checkAllSprites
  {
  
      NSMutableArray *spritesToDelete = [NSMutableArray array];
      for (int index = 0; index &lt; [points count] - 1; index ++)
      {
          for (MatchObject *planetLike in objects)
          {
              CGPoint point1 = [[points objectAtIndex:index] CGPointValue];
              CGPoint point2 = [[points objectAtIndex:index+1] CGPointValue];
              if ([GameLayer lineIntersectsCircle:point1 :point2 :[planetLike position] :16.0f])
              {
  
                  ParticleSystem *planetDeath = [ParticlePlanetDeath node];
                  planetDeath.texture = [[TextureMgr sharedTextureMgr] addImage:@"fire.pvr"];
                  planetDeath.position = [planetLike position];
                  [self addChild:planetDeath z:0 tag:2];
  
                  [spritesToDelete addObject:planetLike];
  
                  [self removeChild:planetLike cleanup:YES];
  
              }
  
          }
      }
      [objects removeObjectsInArray:spritesToDelete];
      [spritesToDelete removeAllObjects];
  
  }
  </code></pre>
  
  <p>If I do not autorelease in the first function, the app works fine. If I do, then I try to access a dealloced object ([MatchObject position]). </p>
  
  <p>What's wrong?!</p>