iphone - Find out memory leak? -
iphone - Find out memory leak? -
i new on iphone apps.now first app,app installed not run? write code shows memory leak.please find out.thanks in advance.
abrecordref ref = cfarraygetvalueatindex(all, i); cfstringref *firstname = (cfstringref *)abrecordcopyvalue(ref, kabpersonfirstnameproperty); nslog(@"name %@", firstname); contact.strfirstname = (nsstring*)firstname; cfstringref *lastname = (cfstringref *)abrecordcopyvalue(ref, kabpersonlastnameproperty); nslog(@"name %@", lastname); contact.strlastname = (nsstring*)lastname; contact.contactname = [nsstring stringwithformat:@"%@ %@",(nsstring *)firstname,lastname]; nslog(@"name %@", contact.contactname); abmutablemultivalueref phonenumbers = abrecordcopyvalue(ref, kabpersonphoneproperty); for(cfindex j = 0; j < abmultivaluegetcount(phonenumbers); j++) { cfstringref phonenumberref = abmultivaluecopyvalueatindex(phonenumbers, j); nsstring *phonenumber = (nsstring *) phonenumberref; contact.strmobileno = phonenumber; nslog(@"phoneno %@", phonenumber); cfrelease(phonenumberref); } abmultivalueref emails = abrecordcopyvalue(ref, kabpersonemailproperty); for(cfindex k = 0; k < abmultivaluegetcount(emails); k++) { cfstringref emailref = abmultivaluecopyvalueatindex(emails, k); nsstring *mailid = (nsstring *) emailref; contact.strmail = mailid; nslog(@"email %@", mailid); cfrelease(emailref); } cfrelease(emails); cfrelease(phonenumbers);
you using abrecordcopyvalue
on firstname , lastname means need cfrelease
well.
iphone objective-c ios4 abaddressbook
Comments
Post a Comment