Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone - Leaks in MessageUI framework?

I use MFMailComposeViewController to send emails in my app.
When I run my app with Instruments,
I see a leak after I tapped to send the email.

Leaked Object   #   Address Size    Responsible Library Responsible Frame

MutableMessageHeaders,1 0x6be950    32 Bytes    MessageUI   +[MFComposeTypeFactory headersFromDelegate:]

_MFOutgoingMessageBody,1    0x1190ed0   32 Bytes    Message -[MessageWriter createMessageWithPlainTextDocumentsAndAttachments:headers:]

Do you know how to fix it,
is this a leak in MessageUI framework?

- (void)showMailComposer
{
        MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
        picker.mailComposeDelegate = self;
        [picker setSubject:@"Subject"];
        NSString *emailBody = @"Email body";
        [picker setMessageBody:emailBody isHTML:NO];
        [self presentModalViewController:picker animated:YES];
        [picker release];
}

#pragma mark -
#pragma mark Dismiss Mail/SMS view controller

    // Dismisses the email composition interface when users tap Cancel or Send. Proceeds to update the 
    // message field with the result of the operation.
    - (void)mailComposeController:(MFMailComposeViewController*)controller 
              didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error 
{
            [self dismissModalViewControllerAnimated:YES];
    }
like image 989
Tuyen Nguyen Avatar asked Aug 09 '26 00:08

Tuyen Nguyen


1 Answers

Yeah, looks like it. But at a total of 64 bytes per sent email, it’s not one you should be worried about.

like image 52
Noah Witherspoon Avatar answered Aug 10 '26 14:08

Noah Witherspoon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!