title: UIViewControllers And ARC
body: <p>So after much deliberation and a bit of frustration at spending time trying to search for memory management issues i did some research and finally succumbed to changing to ARC. And it was relatively painless. However a new issue has surfaced to do with my UIViewControllers, Pre-arc they all worked as advertised, I pushed them on the stack, they appeared, I popped them off the stack their dealloc method was called and everybody was happy. Changing over to ARC, no dealloc is called, ever. which is unfortunate. So I did some research into the problem, let me list out what i am doing and/or not doing</p>
  
  <p>.firstly, the view i am pushing onto the stack is not explicitly declared strong.</p>
  
  <p>.the delegate the child class has of the parent class is unsafe_unretained, but for covering bases i even commented out setting the delegate to the parent, no joy.</p>
  
  <p>.Turned Off NSzombies as apparently that will cause stuff to stick around in ARC enabled code</p>
  
  <p>.i changed my code, according to brad larsons answer in <a href="https://stackoverflow.com/questions/8747942/memory-not-released-in-ios-view-hierarchy">Memory not released in ios view hierarchy</a>, from this</p>
  
  <pre><code>if (_friendsListVC == nil) 
  {
      _friendsListVC = [[FriendsListViewController alloc] initWithNibName:nil bundle:nil];
      _friendsListVC.delegate = self;
  }
  
  [self.navigationController pushViewController:_friendsListVC animated:YES]; 
  </code></pre>
  
  <p>(_friendsListVC is a member variable). To This</p>
  
  <pre><code> FriendsListViewController *fVC = [[FriendsListViewController alloc] initWithNibName:nil bundle:nil];
   //fVC.delegate = self;
   [self.navigationController pushViewController:fVC animated:YES]; 
  </code></pre>
  
  <p>again no Joy, the dealloc breakpoint never gets hit, and the thing is i push and pop alot of views in my app, so this will only lead to more memory issues, on top of the ones i changed over to ARC to hopefully fix...</p>
  
  <p>Also note i have a few code blocks in this view as well as some of the others but i don't use self which i also read is self retained so you should weak ref's when it comes to code blocks.</p>
  
  <p>i am le stumped, can anyone elucidate me as to what ARC is doing? or what i am not doing in deference to using ARC? and for future reference should all views you want to push onto the view hierarchy in ARC NOT be instance variables?</p>
  
  <p>thanks in advance. </p>