I'm writing custom animations and I suspect that I have a memory leak, but I'm not sure. Every time I run a given animation memory goes up a little, but it doesn't go down. To make sure, I made a test:
NSLog(@"%@", self.weakanim);
// The animation collection to run
HyAnimationCollection * collection = [[HyAnimationCollection alloc] init];
self.weakanim = collection;
First this logs nil
then it always logs an address. So there are two indicators here:
- Memory starts at 9.7MB and goes up 0.1MB every 10 runs of the animation. I tested this to about 12MB. Now, should the memory be freed every time or is it just that ARC (like, say, JVM's garbage collector) only releases memory periodically? That is, maybe it isn't a leak, but instead ARC has not released it yet because I didn't reach a certain amount.
- I declared
weakanim
asweak
just to see if the previous animation collection was being released, but the same issue still arises: is ARC not releasing yet?