Find out memory leak?

i am new on iphone apps.Now this is my first app,app is installed but not run?
I write this code it 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 is %@", 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 is %@", mailid);

    CFRelease(emailRef);

}

CFRelease(emails);
CFRelease(phoneNumbers);

  • There is no .xib file when I create a new “Empty Application” in XCode
  • Install xCode 3.2.3 w/ iPhone SDK 4, get “Base SDK missing”, can't see other SDKs
  • How to hide the red bar under the iOS's status when recording?
  • How to differentiate between screen lock and home button press on iOS5?
  • Xcode iOS organizer submit to app store yields “The archive is invalid” error
  • When are iOS keychain items removed?
  • 3 Solutions Collect From Internet About “Find out memory leak?”

    You are using ABRecordCopyValue on firstName and lastName which means you need to CFRelease those as well.

    CFRelease is a way to go (as @Joe and @jamapag already answered).. I would just like to add that XCode has few nice features like cmd + shift + a gives u a static memory analyser.. And you can also use run -> run w/ performance tools and then use allocations or leaks to analyse our memory management dynamically.

    You need to add:

    CFRelease(firstName);
    CFRelease(lastName);