I am curious about when showsFields
is turned on, the memory usage increase extremely fast? It can growth up to 500MB under 30 seconds. If my mac only have 8GB of RAM, I probably have less than 8 minutes to debug before memory warning, it will be worst when debug on real device.
The screenshot below is tested from a real device (iOS 9.2).
You can quickly try it by creating a SpriteKit project and turn showsFields
on in viewDidLoad()
method inside the view controller.
skView.showsFields = true
If you want to see what showsFields
does, place this snippet inside the scene's -didMoveToView(view:)
method.
override func didMoveToView(view: SKView) {
let myField = SKFieldNode.springField()
myField.position = CGPointMake(frame.midX, frame.midY)
myField.strength = 1.0
self.addChild(myField)
}
Here is showsFields
discussion from Apple
Discussion
When this debugging option is enabled, each time a frame is rendered, an image is drawn behind your scene that shows the effects of any physics fields contained in the scene.
It looks like the debug image drawn per frame is not being cleared up properly which, is probably leading to this memory leak.
Best will to file a bug report with Apple via https://developer.apple.com/bug-reporting/ so they know multiple people are having this issue and can hopefully give a higher priority.
Hope that helps.
Kind regards, Mukund
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With