當生病將一些圖像加載到我的QuicklookController時,所使用的內存永遠不會被內存管理器釋放。例如:iOS 10 Quicklook內存使用
override func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
let photoFile = photos[indexPath.row] as Photo
currentFilePath = photoFile.filePath
let preview = QLPreviewController()
preview.dataSource = self
self.navigationController?.pushViewController(preview, animated: false)
}
func documentsDirectoryURL() -> NSURL {
let manager = NSFileManager.defaultManager()
let URLs = manager.URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)
return URLs[0]
}
func previewController(controller: QLPreviewController, previewItemAtIndex index: Int) -> QLPreviewItem {
return documentsDirectoryURL().URLByAppendingPathComponent(currentFilePath)
}
這裏生病的圖像。圖像大小約爲200kbytes,大小約爲2500x1250像素。內存增加了大約10 MB,但是當關閉控制器(後退按鈕)時仍然使用內存。因此,每次點擊都需要10 MB的額外內存(如果圖像相同,或者新的內存有Doesent問題)
如何強制QLPreviewController
釋放使用的內存?
編輯:看來,這已經報道:
https://github.com/jcamiel/radars/blob/6b02382c08cdd9312df325a7a08ea9efeec5727b/28318213/radar.md
https://forums.developer.apple.com/thread/63020
EDIT2:
與2現在的iPad Pro的測試9.7
首先,iOS版10.0.1 - >如上所述增加內存。 其次,的iOS 9.3.5 - >無內存問題
如此看來它真的只有iOS的10錯誤...