I want to do a very simple thing but it's not working. I want to add some CCParticleSystemQuad in an NSMutableArray and delete them. Here is what I do :
int cpt = 0;
NSMutableArray *myArray = [[NSMutableArray alloc] init];
for (cpt = 0; cpt < 10; cpt++) {
part = [CCParticleSystemQuad particleWithFile:@"whiteExplosion.plist"];
[myArray addObject:part];
}
NSLog(@"state of myArray : %@", myArray);
int cont = 0
for (cont = 0; cont < 10; cont++) {
[myArray removeLastObject:cont];
}
NSLog(@"state of myArray : %@", myArray);
When I NSLog the first time I have this :
state of myArray : (
"<CCParticleSystemQuad = 0x91ee380 | Tag = -1>",
"<CCParticleSystemQuad = 0x84aca20 | Tag = -1>",
"<CCParticleSystemQuad = 0x125136c0 | Tag = -1>",
"<CCParticleSystemQuad = 0x125b0fc0 | Tag = -1>",
"<CCParticleSystemQuad = 0x1250d480 | Tag = -1>",
"<CCParticleSystemQuad = 0x1250fa50 | Tag = -1>",
"<CCParticleSystemQuad = 0x9108840 | Tag = -1>",
"<CCParticleSystemQuad = 0x9152b70 | Tag = -1>",
"<CCParticleSystemQuad = 0x914fb80 | Tag = -1>",
"<CCParticleSystemQuad = 0x9135470 | Tag = -1>"
)
The second time I have this :
state of myArray : (
)
So, as you can see my CCParticleSystemQuad have been removed. But, when I check in Instruments (allocations) they are still living (I have 20 still living [CCParticleSystemQuad allocMemory]) and still using memory for nothing. What am I missing ? BTW I use ARC. I tried with (NSString *) object and it works fine... Thx.