My game is experiencing a strange bug. Every time I run it, it runs very very quickly for the first several minutes, then gradually performance falls off. If I reload the scene, the same thing happens. My first thought was that one of my MutableArrays that I loop through was growing w/ out me realizing it, so I ran some diagnostics with NSLog, and that's not it. My second thought is that it's a memory management issue, but I don't know terribly much about memory management. Every time one of my bullets collides with something I run this code:
//an array full of a class i wrote to store bullet data, no loops here, only variables
[bullets removeObjectAtIndex:i];
//all my bullets are atlas sprites to save performance, and this is the manager. I don't like actions, so no need for cleanup
[bulletsManager removeChildAtIndex:i cleanup:NO];
//An array of atlas sprites
[bulletSprites removeObjectAtIndex:i];
//Alright, this one is my prime suspect. I have an array of very small (0-5 particle) particle systems, which move with the bullets. I'm not sure if I'm getting rid of them properly.
[[bulletEmits objectAtIndex:i] stopSystem];
//Should I be releasing it? Does it change anything? I tried it both ways and saw no difference
[[bulletEmits objectAtIndex:i] release];
//Fairly self explanatory
[bulletEmits removeObjectAtIndex:i];