0 Replies
      Latest reply on Mar 16, 2020 8:24 AM by zxxz00
      zxxz00 Level 1 Level 1 (0 points)

        Hi, I have a problem with SKScene memory leak

         

        Right after the initilization of a SKScene, memor leak occurs. I don't know what is going on.

         

        Here is my code in GameViewController.swift

                       if let scene = MenuScene(fileNamed: "MenuScene") {
                            // Set the scale mode to scale to fit the window
                            //scene.currentSceneName = "MenuScene"
                            scene.scaleMode = .aspectFill
                            scene.size = self.view.frame.size
                            
                            // Present the scene
                            view.presentScene(scene)
                        }
        

         

        I set a breakpoint at the line

                       if let scene = MenuScene(fileNamed: "MenuScene") 

         

        Before executing the line, there was no memory leak. However, when the program executes the line and advance to next line, memory leak occurs.

         

        The backtree for the leaked blocks is

             @nonobjc SKScene.__allocating_init(fileNamed:)

             GameViewController.viewDidLoad()

             @objc GameViewController.viewDidLoad()

         

             UIApplicationMain

             main

             start