In my opinion, when an object is sent an autorelease message, if autocompletion pools do not exist, except for one in main.m , the object is placed in the object in main.m Assuming this is correct, I have a few questions:
1) Do all auto-implemented objects remain in this pool until the application expires?
2) If the value 1 is true, does an auto-implemented object create without a local pool of auto resources (therefore, it places this object in the main.m pool), storing this object in memory until a notification of receipt or memory is received?
3) When main.m autodetection pool main.m , unless the application receives a memory warning or the application terminates?
For example, in the delegate method cellForRowAtIndexPath, for example:
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Foobar"]; if (cell == nil) { // No cell to reuse => create a new one cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"Foobar"] autorelease]; // lots of custom stuff } return cell;
When are the cells really released? They must be auto-implemented because you cannot release them before you return them, and you cannot release them after they have gone out of scope. According to my current understanding, the cells are placed in the highest pool of autoadvertising and are freed when this pool is merged / freed. In this case, it will be the only pool of autoresists in the application; one in main .
4) The problem with this is that even when I finished working with these cells and the view controller was released, the cells remain in memory, right? If this is not the case, can someone explain how memory management works in this situation? Thanks!
Note. I looked at Apple's documentation, but mostly talks about when to use my own local autorun pools, but not so much about how they work.