Group Group Group Group Group Group Group Group Group

MrPig memory issue

#1

It seems that every time MrPig gets hit by a bus and a new round is launched, reserved memory increases roughly by 200MB which eventually will crash the application after few rounds once reserved memory reaches approximately 1,2GB.

I tried to chase the root cause for this but was unable to understand what actually causes that +200MB increase in memory every time MrPig respawns. Can someone confirm this is a real issue or just a random bug generated by my system? I used version which is in 23-Audio, final_bugfix folder.

#2

@chrislanguage Can you please help with this when you get a chance? Thank you - much appreciated! :]

#3

I have the same issue and in final_bugfix version of the app too. @hemppa do you found how to solve it?

#4

I found that memory leak issue happens even in Chapter 19 final project with code:

override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
    if game.state == .tapToPlay {
      startGame()
    } else {
        gameScene.isPaused = true
        let transition = SKTransition.doorsOpenVertical(withDuration: 1.0)
        scnView.present(splashScene, with: transition, incomingPointOfView: nil, completionHandler: {
            self.game.state = .tapToPlay
            self.setupSounds()
            self.splashScene.isPaused = false
        })
    }
  }
#5

@chrislanguage Do you have any feedback about this? Thank you - much appreciated! :]

#6

I found that issue happens because of:

scnView.present(splashScene, with: transition, incomingPointOfView: nil, completionHandler: {
       self.game.state = .tapToPlay
       self.splashScene.isPaused = false
})

If to present scenes use:

scnView.scene = splashScene
self.game.state = .tapToPlay
self.splashScene.isPaused = false

No memory issue happens

#7

@sergeydi Thank you for sharing your solution - much appreciated! :]

closed #8

This topic was automatically closed after 166 days. New replies are no longer allowed.