Xcode 4:由于dylib错误,iPad模拟器无法使用Enable Guard Malloc [英] Xcode 4: Can't use Enable Guard Malloc due to dylib error for iPad simulator

查看:59
本文介绍了Xcode 4:由于dylib错误,iPad模拟器无法使用Enable Guard Malloc的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Xcode 4.x中,我已将运行方案编辑为启用Guard Malloc",因为我有一个无法描述的malloc错误,需要跟踪.我知道我需要在模拟器中运行才能使用此功能.但是,当我这样做时,该应用程序立即冻结,并且Xcode向我显示了一个如下所示的堆栈跟踪:

我一直在Google周围寻找解决方案,但到目前为止还没有喜悦.据其他地方报道,我应该在我的方案中设置环境变量:

DYLD_INSERT_LIBRARIES  ->  /usr/lib/libgmalloc.dylib

但是,这不能解决问题.我也尝试过使用"lsystem"作为值,但这也不起作用.

有人可以建议解决此dylib问题的方法,还是建议启用保护Malloc"的替代方法来确定超出malloc的堆区域的地方?

更新

为了澄清,这是我正在处理的错误类型:

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

我尝试将符号断点设置为malloc_error_break,但是它仍然会在内存问题上随机"中断,而不是在超出分配的区域时中断.

解决方案

要帮助进行调试,您可以设置有关详细说明,请参阅本文.

In Xcode 4.x I've edited my Run scheme to 'Enable Guard Malloc' since I have a nondescript malloc error I need to track down. I'm aware I need to run in the simulator to use this feature. However, when I do so the app immediately freezes and Xcode shows me a stack trace that looks like this:

I've googled around to find a solution, but thus far no joy. It was reported elsewhere that I should be setting an environment variable in my scheme:

DYLD_INSERT_LIBRARIES  ->  /usr/lib/libgmalloc.dylib

However this doesn't solve the problem. I have also tried 'lsystem' as the value, but that didn't work either.

Can anyone suggest a solution to this dylib issue, or perhaps recommend an alternative to 'Enable Guard Malloc' to identify where a malloc'd heap area is being exceeded?

UPDATE

To clarify, this is the type of error I'm dealing with:

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

I've tried setting a symbol breakpoint of malloc_error_break, however it still breaks 'randomly' upon memory issues rather than at the point of exceeding an allocated region.

解决方案

To help with the debugging you can set MallocStackLogging, then when your App crashes, type this in the gdb console:

(gdb) info malloc-history 0x543216

Replace 0x543216 with the address of the object that caused the crash, and you will get a much more useful stack trace and it should help you pinpoint the exact line in your code that is causing the problem.

See this article for more detailed instructions.

这篇关于Xcode 4:由于dylib错误,iPad模拟器无法使用Enable Guard Malloc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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