gpt4 book ai didi

iOS 10 快速查看内存使用情况

转载 作者:行者123 更新时间:2023-11-30 13:03:35 25 4
gpt4 key购买 nike

当我将一些图像加载到我的 QuicklookController 时,内存管理永远不会释放已使用的内存。例如:

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)
}

这里将加载图像。图像大小约为200kbyte,大小约为2500x1250像素。内存增加了大约 10 MB,但是当我关闭 Controller (后退按钮)时,内存仍然在使用。因此,每次点击都会花费 10 MB 的额外 RAM(无论图像是相同的还是新的,这都无关紧要)

如何强制 QLPreviewController 释放已用内存?

编辑:似乎已经报告了这一点:

https://github.com/jcamiel/radars/blob/6b02382c08cdd9312df325a7a08ea9efeec5727b/28318213/radar.md

https://forums.developer.apple.com/thread/63020

编辑2:

现已使用 2 个 iPad Pro 9.7 进行测试

首先,iOS 10.0.1 -> 如上所述,内存增加。二、iOS 9.3.5 -> 无内存问题

所以看起来这确实只是一个 iOS 10 Bug...

最佳答案

似乎已在 iOS 10.0.2 中修复

关于iOS 10 快速查看内存使用情况,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39642000/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com