title: When an instance is deallocated under ARC, are all its strong pointers automatically set to nil?
body: <p>I've looked all over for the answer to this, and all the tutorials of ARC I've seen never make this explicitly clear: </p>
  
  <p>I'm using ARC.  If an instance is deallocated (because the last strong pointer to it was set to nil), does that instance's strong pointers also automatically get set to nil and/or whatever objects it points to get deallocated?</p>
  
  <p>For example:  I have two classes, Foo and Bar, and I have an instance of Foo, myFoo.</p>
  
  <p>Inside myFoo, I create an instance of Bar (which is strong by default).</p>
  
  <pre><code>Bar *myBar = [Bar new]; 
  </code></pre>
  
  <p>Now, in whatever instance that owns myFoo, I deallocated it.</p>
  
  <pre><code>myFoo = nil;
  </code></pre>
  
  <p>Does the myBar automatically go to nil (or more precisely, its retain count decremented)?</p>
  
  <p>EDIT</p>
  
  <p>I've narrowed it down to this code. I'm using sprite kit. This code is inside an instance which is owned by my Play view. </p>
  
  <pre><code>// tick marks every 20 pix.
  for (long h=0; h&lt;20000; h+=20) {
  
      SKShapeNode *line = [SKShapeNode node];
      CGMutablePathRef pathToDraw = CGPathCreateMutable();
      CGPathMoveToPoint(pathToDraw, NULL, 0, h+yOffset+5);
      CGPathAddLineToPoint(pathToDraw, NULL, 10, h+yOffset+5);
      line.path = pathToDraw;
      line.lineWidth = 1;
      [line setStrokeColor:[UIColor grayColor]];
      [rulerContainer addChild:line];
      CGPathRelease(pathToDraw);
  }
  </code></pre>
  
  <p>(I know I should be lazy loading the tick marks; this puts 1000 of them there all at once, but it runs fast so figured it was ok; and they should be getting deallocated anyway).</p>
  
  <p>When I comment-out [rulerContainer addChild:line], the allocation problem drops to almost zero.
  When that line is in, it's 5MB added every time I go back to Menu view.</p>
  
  <p>Why should the lines be hanging around after the scene and view controller are deallocated?</p>
  
  <p>UPDATE</p>
  
  <p>I added this to my VC based on another thread on SO...</p>
  
  <pre><code>- (void) dealloc
  {
      if (self.scene != nil)
      {
          [self.scene removeAllActions];
          [self.scene removeAllChildren];
  
          self.scene = nil;
  
          [self.skView presentScene:nil];
  
          self.skView = nil;
      }
  }
  </code></pre>
  
  <p>.. but you SHOULDN'T have to do this.  Anyway, this solved the problem.  Hope it helps someone else.</p>