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];
}
"ビルドと分析"を実行すると、アナライザの結果は返されません。 私はInstrumentsとプロファイリングを実行しようとしますが、これはライブラリの問題のように見えますか? – Poff
MailCoreに問題がある可能性があります。 Appleのフレームワークには問題はありません。何が漏れているのですか? –
MailcoreはLibetpan(Cメールライブラリ)を使用して実装されています。責任フレームのほとんどは、Libetpanのライブラリからのものと思われます。メモリを割り当てる関数である "mailmime_fields_new"や "mailimf_date_time_new"など。それから私はMailCoreから "[CTCoreMessage setSubject]"のような責任フレームを取得します。ここに、リークのスタックトレースがあります:http://pastebin.com/GgLypLUw – Poff