.showsPhysics的内存泄漏 [英] Memory Leak for .showsPhysics
问题描述
我刚刚花了最近5个小时尝试在我的Spritekit App中调试内存泄漏。
I have just recently spent the past 5 hours trying to debug a memory leak in my Spritekit App.
应用启动后,我注意到我的记忆中有一小段爬升用法。
After app Launch, I noticed a small climb in my memory usage.
我花了5个小时中的3个时间挖掘参考资料,用 ARC (绝对推荐读一下像我这样的中间人)
I spent 3 of those 5 hours digging through reference material, learning about strong VS Weak with ARC (Definitely Recommend Reading up on that for Intermediates Such as myself)
还有其他人遇到过这个问题吗?如果有的话有什么解释吗?这是我的GameViewController的一小部分:
Is anyone else experiencing this issue? If so is there any sort of 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")
}
}
正如你所看到的,我在这里并没有做任何与众不同的事情。我会发布我的gamecene代码,但在我仍在观察内存泄漏的时候,它都被注释掉了。
As you can see, I'm not doing anything out of the ordinary here. I would Post my gamescene code, but it was all commented out at the time I was still observing the memory leak.
推荐答案
最终出于苛刻,我刚开始评论代码行,然后构建和分析,直到内存泄漏得到解决。
Eventually, out of fustration, I just started commenting lines of code, then building and profiling until the memory leak was solved.
在我的GameViewController.swift文件中,
Turns out in my GameViewController.swift file,
skView.showsPhysics = true
是罪魁祸首。这有点像一个新的错误,因为我在<中没有看到这个问题。 IOS 9.2
was the culprit. This must be somewhat of a new bug seeing as how I haven't seen this issue in < IOS 9.2
这篇关于.showsPhysics的内存泄漏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!