title: Problems in memory management
body: <p>Have problems with memory have code that looks like this:</p>
  
  <p>Have EXC_BAS_ACCESS</p>
  
  <pre><code>@interface MapList : NSObject
  {
      NSArray* m_units;
  }
  -(MapList*) loadMapListWithLevel:(uchar) lvl chapter: (uchar) chapt;
  -(void) dealloc;
  @end
  </code></pre>
  
  <p>and implementation:</p>
  
  <pre><code>-(MapList*) loadMapListWithLevel:(uchar) lvl chapter: (uchar) chapt
  {
      self =[super init];
      if (self)
      {
           {
              ...
  
              NSMutableArray* array = [[NSMutableArray alloc] initWithCapacity:size];
  
              for (uint j=0;j&lt;size;j++)
              {
                  obj =[[SpriteDB alloc] init];
                  [array addObject:obj];
                  [obj release];
              }
              if (i==0)
                  m_units = [NSArray arrayWithArray:array];
  
              [array release];
          }
          ...
      }
      return self;
  }
  
  -(void) dealloc
  {
      [m_units release];
      [super dealloc];
  }
  </code></pre>
  
  <p>And in one method I call them like this</p>
  
  <pre><code>MapList* mpl = [[MapList alloc] loadMapListWithLevel:level chapter:chapter];
  [mpl release];
  </code></pre>
  
  <p>Where is problem? When I comment <code>[m_units release];</code> it works...</p>