Chap 3 Actions: Memory Leak does not happen

In Chapter 3, there is a note saying we need to use [weak self] in the action closure to prevent memory leak. However, I tried with the following code and run the Instruments Leak checks and can’t see the leak happening.

run(SKAction.repeatForever(
SKAction.sequence([SKAction.run() {
self.spawnEnemy()
},SKAction.wait(forDuration: 2.0)])))

I also tried to remove the crazy cat lady using following closure without [weak enemy], again I can’t see the leaking.
let removeAction = SKAction.run(){
enemy.removeFromParent()
}
enemy.run(SKAction.sequence([actionMove, removeAction]))

Can anyone verify this?
What’s going on here? I am using Xcode 8.3.3, running on simulator iOS10.3.1

I’m also not seeing any memory fluctuations, but for a different case, same point in the chapter. I leave the weak self, but after that the chapter goes on to talk about how the endless army of cat ladies is going to keep building up and eating up memory. However, profiling the app, I see ZERO memory fluctuations no matter how long I let the app run. I’m guessing under the hood the OS is managing memory better by not keeping the stuff offscreen in memory somehow. Can anyone shed more light on this?

Using Xcode 9.2 beta (9C232C)

You can read more about memory management in Swift best practices and guidelines over here:

I hope this helps. Thanks!

I think the memory use doesn’t fluctuate because of this: https://developer.apple.com/documentation/spritekit/skview/1519683-shouldcullnonvisiblenodes

Basically the view automatically culls non-visible nodes from the rendering tree by default.

The link you referenced has nothing to do with this issue btw.