ios fmdb memory leaks -


hi im asking question friend, struggling fmdb memory issue. project read list db, , opens db , read data each cell, (which not idea did), in init, init database queue,

 databasequeue = [[fmdatabasequeue alloc] initwithpath:_dbpath]; 

in cellforrowatindexpath, use configcell things

- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath{ static nsstring * addressbooktableviewcellidentifier = @"addressbooktableviewcell"; addressbooktableviewcell * cell = (addressbooktableviewcell*)[tableview dequeuereusablecellwithidentifier:addressbooktableviewcellidentifier]; if (cell == nil) {     // create cell display ingredient.     cell = [[[addressbooktableviewcell alloc] initwithstyle:uitableviewcellstylesubtitle                                             reuseidentifier:addressbooktableviewcellidentifier]             autorelease];     cell.selectionstyle = uitableviewcellselectionstyleblue; } [self configcell:cell atindexpath:indexpath]; return cell; 

}

-(void)configcell:(addressbooktableviewcell *)acell atindexpath:(nsindexpath *)indexpath{  __block  nsdictionary *auserrecord = nil;  nsstring *_username = nil;     [databasequeue indatabase:^(fmdatabase *db) {          [db open];         int offset = 0;          offset +=indexpath.row;          nsstring *str = [nsstring stringwithformat:@"select table_ems_user.pid,\                          table_ems_user.user_id,\                          table_ems_user.user_name,\                          table_ems_user.sex,\                          table_ems_user.jid,\                          table_ems_user.signature,\                          table_ems_user.head\                          table_ems_user order name_spell limit %d,1",offset];         fmresultset *_rs = [db executequery:str];         while ([_rs next]) {             auserrecord = [_rs resultdictionary];         }         [_rs close];         [db close];     }];      acell.textlabel.text = [auserrecord objectforkey:@"user_name"];  } 

as can see, read db , set cell's label; instrument, when scrolling tableview, memory allocations increases dramatically(from 800k increases 1.6m soon), if comment line acell.textlabel.text = [auserrecord objectforkey:@"user_name"]; seems no memory leaks previous scenario,(from 800k 900k).

by comment line, still db work, it's strange here, must thing links cell , db or block, makes whole thing bad.

i check retain count of rs,auserrecord 1, , seems normal. expert in block, db, , fmdb pls share opinions, cheers

edit: fmdb indatabase function manages block in dispatch queue process, tried remove block , use db job, memory issues remains, pls help

maybe help. guessing.

acell.textlabel.text = [nsstring stringwithformat:@"%@", [auserrecord objectforkey:@"user_name"]]; 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -