Note that there are some explanatory texts on larger screens.

plurals
  1. POReceiving memory warning when using performSelectorInBackground
    primarykey
    data
    text
    <p>I have a UITableView that, when items are selected, loads a viewController, which inside it performs some operations in the background using performSelectorInBackground. </p> <p>Everything works fine if you slowly tap items in the tableView (essentially allowing the operations preforming in background to finish). But when you select the items quickly, the app quickly returns some memory warnings until it crashes, usually after about 7 or 8 "taps" or selections.</p> <p>Any idea why this would be? When I move my code from the background thread to the main thread, everything works fine as well. You just can't make the tableView selections as quickly because it's waiting for the operations to finish.</p> <p>Code snippets:</p> <pre><code>//this is called from - (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath -(void) showLeaseView:(NSMutableDictionary *)selLease { LeaseDetailController *leaseController = [[LeaseDetailController alloc] initWithNibName:@"LeaseDetail" bundle:nil]; leaseController.lease = selLease; //[leaseController loadData]; [detailNavController pushViewController:leaseController animated:NO]; [leaseController release]; } //this is in LeaseDetailController - (void)viewDidLoad { [self performSelectorInBackground:@selector(getOptions) withObject:nil]; [super viewDidLoad]; } -(void) getOptions { NSAutoreleasePool *apool = [[NSAutoreleasePool alloc] init]; NSArray *arrayOnDisk = [[NSArray alloc] initWithContentsOfFile:[appdel.settingsDir stringByAppendingPathComponent:@"optionData"]]; NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(LEASE_ID contains[cd] %@)", [lease leaseId]]; self.options = [NSMutableArray arrayWithArray:[arrayOnDisk filteredArrayUsingPredicate:predicate]]; [arrayOnDisk release]; [apool release]; } </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.
    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