开发者

incorrect checksum for freed object - How do I troubleshoot on device?

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

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.

When using Malloc开发者_开发知识库StackLogging 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.

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.

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!!!

Thanks in advance.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜