SpriteKit Physics Memory Leak

Published on: 21 Mar 2016

Last updated on: 21 Aug 2019

During testing I discovered my game was leaking a small amount of memory each second. Using Instruments I discovered the problem seemed to be connected to PhysicsKit.

In GameViewController I had enabled showPhysics to check the physics bodies of the nodes. This was causing the memory.

skView.showsPhysics = true

It’s not a big problem as this would not be enabled for a shipping game but it might help if you have a similar problem.