I have an animation in the menu of my app. I initialise it in the view controller, store in an array and then access and run the animation like this:
let animationFrames = SKAction.animateWithTextures(animationTextures.animationFrames[0], timePerFrame: 0.05)
let repeatAnimation = SKAction.repeatActionForever(animationFrames)
animation = SKSpriteNode(texture: animationTextures.firstFrame[0])
animation.size = CGSizeMake(self.frame.size.width, 150)
animation.position = CGPoint(x: CGRectGetMidX(self.frame), y: self.frame.size.height - 75)
animation.runAction(repeatAnimation)
The problem is that it allocates way too much memory than it's supposed to. It's something like 4-5MB animation, but from what I can see when I run the app it allocates memory every time the animation starts over and it ends up taking about 50MB after 5-6 iterations and then it doesn't allocate any additional memory.
It's ok on iPhone 5 and above because there's enough memory to handle the app, but since I don't have just this one animation but a couple it ends up allocating 200MB and causes my app to crash on iPhone 4 and 4s.