簡體   English   中英

“class 的 NSURL 自動釋放,沒有適當的池 - 只是泄漏”幫助

[英]“of class NSURL autoreleased with no pool in place - just leaking” Help

-(void)setIT:(customOfferCell *)curr {
    NSAutoreleasePool *imagePool = [ [ NSAutoreleasePool alloc ] init ];

    NSURL *url = [[NSURL URLWithString:imageURL]autorelease];
    NSData *imageData = [[NSData dataWithContentsOfURL:url] autorelease];
    curr.offerImage.image = [[UIImage imageWithData:imageData]autorelease];
    [imagePool drain];
}

嗨,我有標題錯誤並且程序運行良好,但是泄漏的數量讓我很擔心,我調查了導致它的原因,因為這個方法是在一個新線程上調用的:

[NSThread detachNewThreadSelector: @selector(setIT:) toTarget:self withObject:cell];

我需要創建一個自動釋放池並自動釋放對象。 調用上述方法將圖像加載到我的自定義 UITableViewCell 上。 當我運行它時,我會在甚至沒有運行的委托上遇到奇怪的錯誤。 任何人都可以幫忙嗎?

謝謝!

您正在使用返回自動釋放值的工廠方法創建對象,然后自動釋放它們,這應該導致過度釋放問題,而不是泄漏。 盡管。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM