title: Memory Optimization With UIView
body: <p>I have a custom subclass of UIView who has been allocated. Every time I invoke the class, i need to realloc it's subviews like this:</p>
  
  <pre><code>- (void)invoke{
      [[self subviews] makeObjectsPerformSelector:@selector(removeFromSuperview)];
      for(NSDictionary *dict in self.list){
          MySubview *subView = [[MySubview alloc] initWithFrame:self.view.frame];
          [self addSubview:subView];
      }
  }
  </code></pre>
  
  <p>So the result is that every time I invoke it, the memory increases by around 4MB.<br />
  Then how can I fix it and optimize my memory?</p>