正在释放的“iPhone - 调试”指针未被分配“错误 [英] iPhone - debugging "pointer being freed was not allocated" errors

查看:117
本文介绍了正在释放的“iPhone - 调试”指针未被分配“错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

过度释放指针时,您可能会看到一个错误,例如

When over freeing a pointer you may see an error such as

释放的指针未分配

当使用模拟器调试时,我添加了一个构建参数MallocStackLogging = YES - 这允许我在终端中使用malloc_history跟踪我已经释放指针的位置。

When debugging with the simulator, I add a build argument MallocStackLogging = YES - this allows me to use malloc_history in the terminal to track down where I have over freed a pointer.

如果我在设备上用这个生成参数调试,我得到各种控制台错误无法创建堆栈日志文件等。

If I debug on the device with this build argument I get all sorts of console errors "cannot create stack log files" etc.

奇怪的是,我得到一些

有没有人使用设备本身跟踪这些指标?

Has anyone had any experience tracking these down using the device itself?

谢谢!

推荐答案

确保打开NSZombie,所以它报告获取额外的版本的对象的内存地址。然后使用性能工具 - >对象分配运行。这将提出文书。查看Xcode组织器提供的控制台日志。一旦你得到崩溃查找仪器中的内存地址。您将在该对象上看到malloc / frees的整个历史记录,以及直接进入您的代码的链接。

Another way to do this. Make sure to turn NSZombie on so it reports the memory address of the object that is getting the extra release. Then Run with Performance Tool->Object Allocations. This will bring up instruments. Look at the Console log as provided by Xcode organizer. Once you get the crash lookup the memory address in instruments. You will see the entire history of mallocs/frees on that object, as well as links straight into your code.

这篇关于正在释放的“iPhone - 调试”指针未被分配“错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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