Sprite Kit应用程序中的内存泄漏 [英] Memory Leak in Sprite Kit Application

查看:130
本文介绍了Sprite Kit应用程序中的内存泄漏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个我在Xcode 5中创建的Sprite Kit游戏,当使用Instruments对其进行泄漏分析时,我发现确实存在一些泄漏:

I have a Sprite Kit game that I created in Xcode 5 and when profiling it for leaks using Instruments I see that there are indeed some leaks:

问题是我不能告诉我来自我的应用程序的位置,因为负责框架栏目没有指向我的应用程序中的任何位置。

The problem is that I can't tell where in my application this is coming from as the "Responsible Frame" column doesn't point me to anywhere in my application.

如何进行调试/跟踪这个问题的根源?

How would one go about debugging/tracking the origins of this issue?

更新#1

只有一个我正在与CGPath进行交互的文件,但我正在调用 CGPathRelease

There is only one file in which I'm interacting w/ CGPath but I am calling CGPathRelease

...
CGMutablePathRef path = CGPathCreateMutable();

CGPathMoveToPoint(path, NULL, 0, 0);
CGPathAddLineToPoint(path, NULL, size.width, 0);
CGPathAddLineToPoint(path, NULL, size.width, (upperCount * size.width));
CGPathAddLineToPoint(path, NULL, 0, (upperCount * size.width));

CGPathCloseSubpath(path);

upper.physicsBody = [SKPhysicsBody bodyWithPolygonFromPath:path];

CGPathRelease(path);
...        

更新#2

切换打开仪器右侧面板后,我能够看到有问题的线条(虽然我仍然不确定这里是不是错误):

After toggling open the right panel in Instruments I was able to see the offending lines (although I'm still not sure is wrong here):

第一组泄漏...

The first set of leaks...

第二组泄漏...

The second set of leaks...

推荐答案

你见过这个吗? SKPhysicsBody bodyWithPolygonFromPath内存泄漏

看起来喜欢它在SKPhysicsBody中的一个spritekit错误(我猜它会保留在bodyWithPolygonFromPath中但是没有发布)。

Looks like its a spritekit bug in SKPhysicsBody (I would guess it is being retained within bodyWithPolygonFromPath but not released).

这篇关于Sprite Kit应用程序中的内存泄漏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆