2011-04-17 74 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

回答

相關問題