title: Memory management, release needed?
body: <p>I wonder if someone could quickly help me with the following, do I need to add a [myTableView release]; after I call [view addSubview:[self myTableView]]; ? Initially I was thinking no, and running it through CLANG produced to memory warnings</p>
  
  <p>Here is my thinking: </p>
  
  <ul>
  <li>[self setMyTableView:tempTableView]; retainCount = (+1)</li>
  <li>[view addSubview:[self myTableView]]; retainCount = (+2)</li>
  <li>//[myTableView release]; &lt;&lt; HERE retainCount = (+1)</li>
  <li>-dealloc [myTableView release];       retainCount = ( 0)</li>
  </ul>
  
  <p>.</p>
  
  <pre><code>@property (nonatomic, retain) UITableView *myTableView;
  </code></pre>
  
  <p>.</p>
  
  <pre><code>- (void)loadView {
      NSLog(@"%s", __PRETTY_FUNCTION__);
  
      [self setTitle:@"Location Data"];
      CGRect viewFrame = CGRectMake(0, 20, 320, 460);
      UIView *view = [[UIView alloc] initWithFrame:viewFrame];
  
      CGRect tableFrame = CGRectMake(0, 0, 320, 416);
      UITableView *tempTableView = [[UITableView alloc] initWithFrame:tableFrame];
      [self setMyTableView:tempTableView];
      [tempTableView release];
  
      [view addSubview:[self myTableView]];
      //[myTableView release]; &lt;&lt; HERE
  
      [[self myTableView] setDelegate:self];
      [[self myTableView] setDataSource:self];
  
      [self setView:view];
      [view release];
  }
  </code></pre>
  
  <p>.</p>
  
  <pre><code>- (void)dealloc {
      [myTableView release];
      [dataModel release];
      [super dealloc];
  }
  </code></pre>
  
  <p><strong>EDIT:</strong> <em>hmm maybe I don't as [view addSubview:[self myTableView]]; retains it and will release when done. Your right Carl, my bad. I was getting confused with: alloc, set, release, when this is simply the view taking ownership (and the responsibility to release that later)</em></p>