Memory leak for .showsPhysics

I recently spent the last 5 hours trying to debug a memory leak in my Spritekit application.

After starting the application, I noticed a slight increase in memory.

I spent 3 of these 5 hours breaking through the reference material, learning about the strong VS Weak with ARC (I definitely recommend reading this for Intermediates like me)

Anyone else having this problem? If so, is there any explanation? Here is a small snippet of my 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") } } 

As you can see, I am not doing anything unusual here. I would post the code of my game, but all of this was commented out while I was still observing a memory leak.

+8
ios memory-leaks swift sprite-kit
source share
2 answers

In the end, due to frustration, I just started commenting on lines of code, and then built and profiled until a memory leak was resolved.

It appears in my GameViewController.swift file,

 skView.showsPhysics = true 

was the culprit. This should be a slightly new mistake, seeing how I did not see this problem in <iOS 9.2

+8
source share
 skView.showsFPS = true skView.showsNodeCount = true skView.showsPhysics = true 

There will be a memory leak of at least 3.3 MB / s.

Further...

 skView.showsFields = true 

enter image description here

A memory leak at a speed of 30-40 MB / s. Bad Apple!

+3
source share

All Articles