ios – .showsPhysics的内存泄漏

我刚刚花了最近5个小时试图在我的Spritekit App中调试内存泄漏.

应用程序启动后,我注意到我的内存使用率略有上升.

我花了5个小时中的3个时间挖掘参考资料,用ARC学习强VS弱(绝对推荐读取中间体,比如我自己)

还有其他人遇到过这个问题吗?如果有的话有什么解释吗?这是我的GameViewController的一小部分:

class GameViewController: UIViewController {

override func viewDidLoad() {
    super.viewDidLoad()

    if let scene = MainMenu(fileNamed:"MainMenu") {
        // Configure the view.
        let skView = self.view as! SKView
        skView.showsFPS = true
        skView.showsNodeCount = true
        skView.multipleTouchEnabled = true
        skView.showsPhysics = true

        /* Sprite Kit applies additional optimizations to improve rendering performance */
        skView.ignoresSiblingOrder = true

        /* Set the scale mode to scale to fit the window */
        scene.scaleMode = .Fill

        //var GameSaveData = GameData()

        // Scene Config
        //scene.Landscape = "Test_Landscape"
        //scene.Area = "Start"

        skView.presentScene(scene)
    }else{

        print("Couldn't Load Game Scene")
    }
}

正如你所看到的,我在这里并没有做任何与众不同的事情.我会发布我的gamescene代码,但在我仍在观察内存泄漏的时候,它都被注释掉了.

解决方法

最终,出于贪图,我刚开始评论代码行,然后构建和分析,直到内存泄漏得到解决.

原来我的GameViewController.swift文件,

skView.showsPhysics = true

是罪魁祸首.这有点像一个新的错误,因为我在<中没有看到这个问题. IOS 9.2

以上是来客网为你收集整理的ios – .showsPhysics的内存泄漏全部内容,希望文章能够帮你解决ios – .showsPhysics的内存泄漏所遇到的程序开发问题。

如果觉得来客网网站内容还不错,欢迎将来客网网站推荐给程序员好友。