问题描述
我在Xcode控制台中收到此错误,有时会导致模拟器退出,有时会被忽略。如果我在游戏加载后等待几秒钟,通常会被忽略:
I'm getting this error in the Xcode console, sometimes it causes the simulator to exit and sometimes it is ignored. It will usually be ignore if I wait a few seconds once the game is loaded:
malloc: *** error for object 0x55ac484: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
1)我如何识别这个对象?
1) How can I identify this object?
2)如何访问malloc以输入BP,以及这将实现什么?
2) How can I access malloc to put a BP in, and what will this achieve?
谢谢!
推荐答案
Instruments-Tool提供了一种查找Zombies的方法。
The Instruments-Tool provides a way to find Zombies.
要查找导致您的应用崩溃的僵尸,请在XCode 4中选择产品>个人资料。将打开一个新窗口,您必须选择僵尸。现在单击窗口右下角的配置文件。如果您现在向已释放的对象发送消息,它将显示它是什么类型的对象以及发送消息的方法。
To find the Zombie which causes your app to crash, select Product > Profile in XCode 4. A new window will open where you have to choose "Zombies". Now click "Profile" in the bottom-right corner of the window. If you now send a message to a freed object, it will show you what type of object it is and which method sent the message.
要设置断点,您只需要单击您希望应用暂停的行号。应用程序暂停后,您可以逐步运行应用程序,这样您就可以看到代码的哪一部分导致崩溃。
To set a breakpoint you just have to click on the line number you want your app to pause. After your app paused you can run your application step by step, so you will be able to see, which part of your code causes the crash.
这篇关于Xcode malloc错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!