If I run this code in a SKScene sublass init method
for (int i = 0; i < 100; i++) {
SKShapeNode *shape = [SKShapeNode node];
shape.antialiased = NO;
CGMutablePathRef path = CGPathCreateMutable();
CGPathAddEllipseInRect(path, NULL, CGRectMake(arc4random()%320, arc4random()%320, 10, 10));
shape.path = path;
[shape setStrokeColor:[UIColor blackColor]];
CGPathRelease(path);
[self addChild:shape];
[shape removeFromParent];
}
and everytime I run this code in my SKView controlling controller
SKView * skView = (SKView *)self.view;
// Create and configure the scene.
SKScene * scene = [ZTMyScene sceneWithSize:skView.bounds.size];
scene.scaleMode = SKSceneScaleModeAspectFill;
// Present the scene.
[skView presentScene:scene];
my memory usage grow until the memory is full and crashes. This does not happen if I use a SKSpriteNode. Has anyone a fix for this?
Summary: I create the sprite kit template project, add a lot of SKShapeNodes and replace the old SKScene with a new one.
I added a sample project to github https://github.com/zeiteisen/MemoryTest