2011-04-17 77 views
3

我突然接到了上百个这样的线在我的控制台日志运行的使用进度控制我实现了一个过程:NSCFString autoreleased没有到位 - 只是泄漏?

** __NSAutoreleaseNoPool(): Object 0x7afafd0 of class NSCFString autoreleased with no pool in place - just leaking 
** __NSAutoreleaseNoPool(): Object 0xd8ca4a0 of class __NSCFData autoreleased with no pool in place - just leaking 

我在iPhone模拟器多线程环境是,使用Web客户端从网络下载文件()。我很困惑如何处理这个问题,因为我不知道可能会导致问题的原因。运行下载的线程嵌入

using (var oAutoRelease = new NSAutoreleasePool ()) 

我连接到Web客户端的DownloadProgressChanged方法,并在那里我打电话委托其更新进度视图。如果我删除此行,警告都不见了:

ProgressInfo(ACTION.ReceivingResponse, e.ProgressPercentage); 

调用轮流委托将回到我的进步控制器和UDPATE标签:

// iIndicator = the value of e.ProgressPercentage. 
oProgressController.CurrentActivity = "Percentage done: " + iInidicator.ToString () + "%"; 
// ProgressController.CurrentActivity: 
this.InvokeOnMainThread(delegate { this.oLblCurrentActivity.Text = value; }); 

缺少什么我在这里!?

编辑:我想通了,我不得不把另一个NSAutoReleasePool()围绕this.InvokeOnMainThread(delegate { this.oLblCurrentActivity.Text = value; }); 但是,为什么?整个事情已经在一个单独的池中。

+0

东西是不包含在池中,可能是从一个异步方法回调。 – 2011-04-19 14:38:42

回答

相关问题