I'm using Xcode8
and Swift 3
.
After creating a new SpriteKit
project, the top of GameScene.swift defines GameScene
as child class of SKScene
.
When the project is running in the Simulator, I press the Symbol for the Debug Memory Graph (three small connected circles above the Debug Area). As expected, there are no memory issues.
Now, I add a new class (called ParentScene) to GameScene.swift:
GameScene has a new parent
Now, SKScene
is the parent of ParentScene, and ParentScene is the new parent of GameScene.
Running this project in the Simulator and capturing the memory graph leads to the following issues:
memory issues
When running the project on my iPhone instead, the memory graph does not report any leaking objects.
My actual SpriteKit
game project is also implementing a ParentScene between SKScene
and GameScene
and is triggering the memory issues in the Simulator AND on my device.
What is the reason for the leaking objects?