title: SKShapeNode consuming too much memory and slowing down animation -Spritekit iOS
body: <p>I am using SKShapeNode to to create a mountain like object . I use CGMutablePathRef to give the points to my path </p>
  
  <pre><code>SKShapeNode *shapenode = [[SKShapeNode alloc] init];
  
  CGMutablePathRef path = CGPathCreateMutable();
  CGPathMoveToPoint(path, NULL, 0, 0);
  ......
  for (int i = 0; i &lt; [refData count];i++) {
  
  
      CGPathAddLineToPoint(path, NULL, ((float)i/[refData count])*screenWidthBoundry,      [[refData objectAtIndex:i] doubleValue]);
  }
  
  
  CGPathAddLineToPoint(path, NULL, screenWidthBoundry, 0);
  CGPathAddLineToPoint(path, NULL, 0, 0);
  
  shapenode.path = path;
  shapenode.antialiased = YES;
  shapenode.fillColor = [SKColor colorWithRed:17.0/255.0 green:108.0/255.0 blue:125.0/255.0 alpha:1.0];
  //shapenode.strokeColor = [UIColor clearColor];
  
  shapenode.lineWidth = 1.0f;
  
  shapenode.physicsBody = [SKPhysicsBody bodyWithEdgeChainFromPath:path];
  
  shapenode.physicsBody.affectedByGravity = NO;
  shapenode.physicsBody.categoryBitMask = CollisionTypeMountain;
  shapenode.physicsBody.collisionBitMask = 0;
  shapenode.physicsBody.contactTestBitMask = CollisionTypeBird;
  
  CGPathRelease(path);
  return shapenode;
  </code></pre>
  
  <p>My Problem is that SkShapeNode is slowing down the animation on iPhone 4 (runs smoothly on iPad and iPhone 5 but still not 60 fps) and consuming lot of memory. Can I cache skshapnode object to run animation smoothly ? Any Help is appreciated !! </p>