MemoryLeakTestKit

Swift 4.2 compatible CocoaPods Carthage Swift Package Manager MIT license

一个用于检测 Swift 内存泄漏的测试库。

此库正在开发中。

支持的平台

平台 构建状态
Linux CircleCI
iOS Build Status

用法

import MemoryLeakTestKit


let memoryLeaks = detectLeaks {
    // Create a instance
    return target
}

XCTAssertTrue(
    memoryLeaks.leakedObjects.isEmpty,
    memoryLeaks.prettyDescription
)

示例输出

Summary:
    Found 2 leaked objects

Leaked objects:
    0:
        Description: Node
        Type: Node
        Location: (root).linkedNodes[0]
        Circular Paths: 
            self.linkedNodes[1] === self
    
    1:
        Description: Node
        Type: Node
        Location: (root)
        Circular Paths: 
            self.linkedNodes[0].linkedNodes[0] === self

许可证

MIT