2011-01-07 92 views
0

在我目前正在使用的應用程序中,我使用Mailcore(http://www.mronge.com/m/MailCore/API/)來處理郵件服務器操作。我試圖通過後臺的SMTP連接發送消息。問題是,Leaks告訴我,每次發送消息時都會遇到大量內存泄漏。我試圖找出這是我的錯還是Mailcore的錯。下面的代碼:iPhone和Mailcore內存泄漏問題

從我的視圖控制器:

-(void) send_rfq { 

    CTCoreMessage *repMsg = [[[CTCoreMessage alloc] init] autorelease]; 
    NSDate *now = [NSDate date]; 

    NSString* msgString = [NSString stringWithFormat:@"Date#%@\nRFQ#%@\nSalesRep#%@",[now description], [rfq_entry get_uid],[rfq_entry get_repid]]; 
    [repMsg setBody:msgString]; 
    [repMsg setSubject:@"RFQ Assign"]; 

    [myAppDelegate performSelectorInBackground:@selector(send_msg:) withObject:repMsg]; 

    [self.navigationController popViewControllerAnimated:YES]; 
} 

從我的應用程序的委託:

-(BOOL) send_bg:(CTCoreMessage*) msg { 
    BOOL success = TRUE; 
    @try { 
     [CTSMTPConnection sendMessage:msg server:smtp_server username:smtp_uname password:smtp_pass port:smtp_port useTLS:smtp_tls useAuth:smtp_auth]; 
    } 
    @catch (NSException * e) { 
     //Msg failed to send; 
     success = FALSE; 
    } 
    return success; 
} 

-(void) send_msg:(CTCoreMessage*) msg { 
    NSAutoreleasePool *pool = [ [NSAutoreleasePool alloc] init]; 
    [msg setTo:[NSSet setWithObject:[CTCoreAddress addressWithName:@"testaccount" email:rfq_dest]]]; 
    [msg setFrom:[NSSet setWithObject:[CTCoreAddress addressWithName:@"RFQapp" email:rfq_src]]]; 
    if(![self send_bg:msg]) { 
     UIAlertView * empty_alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Could not send." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]; 
     [empty_alert show]; 
     [empty_alert autorelease]; 
    } 
    [pool release]; 
} 

回答

1

有代碼沒有泄漏您發佈。無論是泄漏是誤報還是它在您的代碼中的其他地方。你有沒有試過用儀器來分析你的應用程序?您是否嘗試過使用構建和分析來對代碼進行靜態分析?

+0

當我運行「構建和分析」,沒有分析儀結果返回。 我會試着運行儀器和分析,但是這看起來像庫問題? – Poff 2011-01-07 20:37:32