Note that there are some explanatory texts on larger screens.

plurals
  1. POiPhone memory leak seems to be out of my control
    primarykey
    data
    text
    <p>So I'm making a very basic Twitter app (it's actually Presence 2 from the Stanford iPhone course that's on iTunes), when I decided I wanted to see if my application was leaking. So I ran Leaks and it found one right off the bat. But when I look at the stack trace the leak appears to happen in the main function when I call UIApplicationMain.</p> <p>The image below shows the stack trace from instruments and the corresponding code in xcode. Does anyone know how I can stop this leak and why it's happening? </p> <p><a href="http://img193.imageshack.us/img193/1237/picture2fnj.png" rel="nofollow noreferrer">alt text http://img193.imageshack.us/img193/1237/picture2fnj.png</a></p> <p>EDIT: Ok I've searched and searched and got to where the problem is, but I still don't know what's going on. I've included the source for the TableViewController I'm having problems with.</p> <p>The leak happens when I set the cell.text to [names objectAtIndex:indexPath.row]. Whats interesting is that it's NSIndexPath that appears to be leaking somehow. How should I be managing memory with the objectAtIndex method?</p> <p>On an unrelated topic, is editing my question post the best way to reply? Or should I have posted my code in a comment? </p> <pre><code>@implementation PersonListTableViewController - (id)initWithStyle:(UITableViewStyle)style { if (self = [super initWithStyle:style]) { NSString *path = [[NSBundle mainBundle] pathForResource:@"TwitterUsers" ofType:@"plist"]; names = [[NSArray alloc] initWithContentsOfFile:path]; } return self; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 0; //return [names count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease]; } cell.text = [names objectAtIndex:indexPath.row]; return cell; } - (UITableViewCellAccessoryType)tableView:(UITableView *)table accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath { return UITableViewCellAccessoryDisclosureIndicator; } - (void)dealloc { [names release]; [super dealloc]; } @end </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload