objective c - Please help with iPhone Memory & Images, memory usage crashing app -


i have issue memory usage relating images , i've searched docs , watched videos cs193p , iphone dev site on memory mgmt , performance. i've searched online , posted on forums, still can't figure out.

the app uses core data , lets user associate text picture , stores list of items in table view lets add , delete items. clicking on row shows image , related text. that's it.

everything runs fine on simulator , on device well. ran analyzer , looked good, starting looking @ performance. ran leaks , looked good. issue when running object allocations every time select row , view image shown, live bytes jumps few mb , never goes down , app crashes due memory usage. sorting live bytes column, see 2 2.72mb mallocs (5.45mb total), 14 cfdatas (3.58mb total), 1 2.74mb malloc , else real small. problem related info in instruments technical , problem solving examples i've seen missing release , nothing complicated. instruments shows core data responsible library 1 (libsqlite3.dylib other) [nssqlcore _prepareresultsfromresultset:usingfetchplan:withmatchingrows:] caller 1 (fetchresultsetrealloccurrentrow other) , im not sure how track down problem is. i've looked @ stack traces , opened last instance of code , found 2 culprits (below). havent been able responses @ on this, if has tips or pointers, i'd appreciate it!!!!

    //this view controller shows title , image     - (void)viewwillappear:(bool)animated      {         [super viewwillappear:animated];     self.title = item.title;     self.itemtitletextfield.text = item.title;     if ([item.notes length] == 0)      {         self.itemnotestextview.hidden = yes;     } else      {         self.itemnotestextview.text = item.notes;     } //this line instruments points     uiimage *image = item.photo.image;     itemphoto.image = image; }  - (void)tableview:(uitableview *)tableview commiteditingstyle:(uitableviewcelleditingstyle)editingstyle forrowatindexpath:(nsindexpath *)indexpath  {     if (editingstyle == uitableviewcelleditingstyledelete)      {         // delete managed object given index path         nsmanagedobjectcontext *context = [fetchedresultscontroller managedobjectcontext];         [context deleteobject:[fetchedresultscontroller objectatindexpath:indexpath]];          // save context.         nserror *error = nil;         if (![context save:&error]) //this line instruments points         {              nslog(@"unresolved error %@, %@", error, [error userinfo]);             exit(-1);         }     }    } 

i suggest store image url instead of image data itself. prevent coredata work , cache big data.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -