Xcode:NSZombie 未捕获错误

发布于 2024-12-01 20:30:52 字数 513 浏览 1 评论 0原文

可能的重复:
Xcode malloc 错误

我的游戏有时会由于此消息而崩溃:

malloc: *** error for object 0x65cfcd4: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug

因此,按照建议,我运行了分配工具尝试找到泄漏的仪器并启用 NSZombie 检测。它说它正在执行期间检查僵尸。

但应用程序崩溃了,什么也没有捕获。

僵尸有什么理由不抓住它?

谢谢。

Possible Duplicate:
Xcode malloc error

My game crashed sometimes due to this message:

malloc: *** error for object 0x65cfcd4: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug

So as advised, I ran the Allocations tool in instruments to try find the leak and tecked Enable NSZombie Detection. It said it was checking for zombies during execution.

But the app crashes and NOTHING is caught.

Any reason why a zombie wouldn't catch it?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

离鸿 2024-12-08 20:30:52

建议不要启用僵尸,僵尸仅适用于 Objective-C,mallocreallocfree 是分配内存的 C 方式,僵尸工具不会捕获这些错误。在 malloc_error_break 中设置断点并查看堆栈跟踪以解决错误。

The advise isn't to enable zombies, zombies are Objective-C only and malloc, realloc and free are the C way of allocating memory, the zombie tool won't catch these errors. Set a breakpoint in malloc_error_break and look at the stack trace to resolve the error.

归属感 2024-12-08 20:30:52

不用太花哨,您可以删除所有免费调用,看看它是否可以解决问题。如果您的项目规模不是很大,这可能比您将使用的任何“专业工具”都要快。如果它解决了问题,只需将 free 调用一一插入,答案就会显而易见。

如果您使用 cocos2d,只需删除所有这些“免费”调用即可。 C内存分配很容易出错。

Without getting too fancy, you can remove all your free calls and see if it fixes the problem. If your project isn't very large scale, this may be faster than any "professional tool" you will use. If it fixes the issue, just plug the free calls one by one and the answer should become apparent.

If you use cocos2d, simply delete all those "Free" calls. C memory allocation is easy to get wrong.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文