释放对象的校验和不正确-如何在设备上进行故障排除? [英] incorrect checksum for freed object - How do I troubleshoot on device?

查看:56
本文介绍了释放对象的校验和不正确-如何在设备上进行故障排除?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我花了几天的时间来寻找许多经验丰富的IOS开发人员可能在其职业生涯的某个时刻或另一个时刻看到的错误:

I have spent several days trying to track down an error that many seasoned IOS developers have probably seen at one point or other in their career:

MyApp-IPad(1403,0x5ab3000) malloc: *** error for object 0x2b3aa04: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug

我在网上搜索后发现,很多人建议使用NSZombieEnabledMallocStackLogging,但是似乎可以肯定的是,除非您使用模拟器,否则这些功能将不起作用.不幸的是,除非我使用实际的设备,否则我永远都不会崩溃,在这种情况下,它每隔几分钟就会发生一次.

I've searched around on the net and discovered that many people recommend using NSZombieEnabled or MallocStackLogging, however it seems to be a given that these do not work unless you are using the simulator. Unfortunately I can never get my crash to occur unless I use the actual device, in which case it happens every few minutes.

使用MallocStackLogging时,我将文件写入本地IPad(在/private/var/mobile/Applications/....中),但似乎没有任何方法可以将.link文件传输到本地机器(因为该设备没有越狱),即使我可以使用malloc_history,也似乎无法在本地计算机上使用它.

When using MallocStackLogging I get a file written to my local IPad (in /private/var/mobile/Applications/....) but there doesn't seem to be any way to transfer that .link file to my local machine (since the device isn't jailbroken) and even if I could there seems to be no way to use it on my local machine with malloc_history.

我能做的最好是让它在运行Instruments-> Allocations时崩溃,但是当我查看该区域时,它指向50多个分配(来自许多不同的函数),但是所有分配已经被释放并且不再有效.所有这些都是ImageIO中的内部分配(start_pass_huff_decoder等).

The best I could do was get it to crash when running Instruments->Allocations, but when I looked at the region it pointed to 50+ allocations (from many different functions), but all were already deallocated and no longer live. And all of them were internal allocations, in ImageIO (start_pass_huff_decoder, etc.)

我正在使用相当复杂的大型代码库,因此无法对整个项目进行代码检查.

I'm working with a fairly complex, large base of code, so code inspection of the entire project is not feasible.

我真的需要某种方法来使调试器在校验和被违反时立即中断,而不是在它恰好在执行不相关的malloc(不提供任何有用信息)时立即中断.在malloc_error_break处设置断点似乎无效.

I really need some way to get the debugger to break as soon as the checksum is violated, rather than later when it just happens to be doing an unrelated malloc, which doesn't offer any useful information. Setting a breakpoint at malloc_error_break seems to have no effect.

很明显,我在某个地方应该有一个无效的指针来写内存,但这不应该,但是我对如何缩小导致它的代码段的范围感到困惑.

Its clear that I have an invalid pointer somewhere writing to memory it shouldn't be, but I'm stuck as to how to narrow down which piece of code is causing it.

任何建议都将非常有帮助!

Any advice or suggestions would be very helpful!!!

谢谢.

推荐答案

您尝试使用设备进行调试吗?尝试nikita zhuk的clang静态分析器和xcode的内置构建和分析功能.您的问题可能是由于内存泄漏引起的.它们都不是完美的解决方案,但是您有时会获得帮助.请尝试,如果您可以通过邮件发送代码,我会调查问题.如果您在通过邮件发送代码方面没有任何问题,请发送给我.首先尝试nikita zhuk的clang静态分析器.

Did you try debugging with device? Try nikita zhuk's clang static analyzer and xcode's built in build and analyze function. Your problem might be due to some memory leak. They both are not perfect solution but you will get help at some points. Try and if you can send your code by mail I'll look into issue.If you don't have any problem in sending code by mail send me. First try nikita zhuk's clang static analyzer.

这篇关于释放对象的校验和不正确-如何在设备上进行故障排除?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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