ios Zombie detection

别来无恙 提交于 2020-01-02 04:24:30

问题


I'm having (in my opinion) a very difficult problem in my code. It crashes randomly at different places in the code. The project is a ARC project.

So my program crashes occaisonally with this messages:

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

I already set a breakpoint for malloc_error_break but I don't get any information out of it. When the code crashes ,XCode shows me the place in the code where it happens. But as I already said the crashes are randomly and do not occur always. But it seems as if the crashes are concentrated at on particular line in the code.

Now, I wanted to debug it using the instruments that come with xcode. After a bit of googling i found the following stuff on stackoverflow: How do I set up NSZombieEnabled in Xcode 4? and Xcode malloc error.

So the first link describes how to start zombie detection out of xcode itself by clicking the run button in xcode and choose "Profile". The problem I have is, that I cannot find "Zombies" when choosing the template for the trace document in my version of xcode (4.2). But if I start Instruments outside xcode (e.g. from finder) I can choose zombies.

Okay, here is what I did:

1) Start Instruments from finder and choose Profile "Zombies".

2) Start iphone app from xcode in the iphone simulator (normal run (not profile or debug)).

3) In Instruments "Choose Target"->"Attach to process"->"iPhone Simulator (57529)".

4) Instruments begins to recod something (I cannot figure out what it does).

5) Start playing around with the app until it crashes.

Eventually the app crashes and here is a screenshot of instruments after crashing the app:

My questions:

1) Is Zombies adequate for my problem or should I use another analyizes tool?

2) What tells me instruments in it's output after crashing?


回答1:


Judging by your description of the problem, your crash is caused by something besides accessing a zombie object. If your app accesses a deallocated (zombie) object, Instruments shows a message like the following when using the Zombies template:



来源:https://stackoverflow.com/questions/9533650/ios-zombie-detection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!