iphone - memory leak using JSONKit when called a second time -


i've read apples docs on memory management , feel understand them can't not leak. in example have process running on main thread keep simple. first time search button clicked works fine, no leaks. second time search clicked/perfomed works find instruments displays following leaks:

leaked object   #   address size    responsible library responsible frame nscfstring,42   < multiple >    1.30 kb ctcontacts  jk_cachedobjects nscfstring,16   < multiple >    464 bytes   ctcontacts  jk_cachedobjects jkdictionary,7  < multiple >    224 bytes   ctcontacts  jk_object_for_token malloc 288 bytes,7  < multiple >    1.97 kb ctcontacts  jk_object_for_token malloc 32 bytes,    0x7859a30   32 bytes    ctcontacts  jk_object_for_token jkarray,    0x78599f0   32 bytes    ctcontacts  jk_object_for_token 

it seems pointing line: (listed %100)

nsdictionary *resultsdictionary = [jsondata objectfromjsondatawithparseoptions:jkparseoptionstrict error:(nserror **)error]; 

i've tried nsdictionary *resultsdictionary =[ [[nsdictionary alloc]init]autorelease]; same result.

below 2 methods involved:

- (void) searchbarsearchbuttonclicked:(uisearchbar *)thesearchbar {     pickerview.hidden=yes; searchbar.showsscopebar=yes; [searchbar setshowscancelbutton:no animated:yes]; [searchbar resignfirstresponder];  [self querywebservice]; }  -(void) querywebservice{  nsstring *urladdress = [nsstring stringwithformat:@"http://myweb.com/json.php?lname=%@&searchtype=%@",searchbar.text,currentsearchcategory];  nsurl *url = [nsurl urlwithstring:urladdress];  asihttprequest *request = [asihttprequest requestwithurl:url]; [request setdelegate:self]; [request startsynchronous]; nserror *error = [request error]; if (!error){     nsstring *responsestring = [request responsestring];     //nslog(@"response: %@", responsestring);      nsdata *jsondata = [responsestring datausingencoding:nsutf8stringencoding];     nserror *error = nil;      nsdictionary *resultsdictionary = [jsondata objectfromjsondatawithparseoptions:jkparseoptionstrict error:(nserror **)error];      if (resultsdictionary)     {         rows = [[resultsdictionary objectforkey:@"contacts"] retain];         resultsdictionary=nil;     } }         [mytableview reloaddata]; } 

nsarray "rows" used tableview datasource. appreciated, thanks.

i'd imagine rows cause. each time run through loop, add retain it. getting rid of retain should trick , rid of memory leak. if reason, retain necessary there, you'll have find place elsewhere release , keep retain count @ proper value


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -