解决SearchKit CoreService中的内存泄漏问题

时间:2018-06-07 00:16:29

标签: swift macos memory-leaks core-services

我一直在使用Apple的SearchKit开展项目。但我最近通过仪器找到了内存泄漏,指向SearchKit。像下面的代码一样

$('.test').removeAttr('required');

这里有一些解释:可以分配给guard let document = SKDocumentCreateWithURL(fileURL)?.takeRetainedValue() else { return false } defer { SKIndexFlush(indexFile) } // Both SKIndexAddDocumentWithText and SKIndexAddDocument are builtin SearchKit let addMethod: documentAddFunc = type == .nameOnly ? SKIndexAddDocumentWithText : SKIndexAddDocument let textContent: CFString? = type == .nameOnly ? (fileName + " \(additionalNote)") as CFString : nil return addMethod(indexFile, document, textContent, true)/* The line where instrument suggests the memory leak happened*/ 的两个函数都是SearchKit内置的函数。 addMethod是SKIndex类型。 indexFile创建在图片的顶部,应该是正确的。

这是苹果方面的一个错误,还是我的问题是触发内存泄漏?我有什么办法可以避免或解决这个问题吗?

非常感谢!

0 个答案:

没有答案