English 中文(简体)
How to interpret some of the Error messages from Xcode console?
原标题:

As my programs involves more and more code Im starting to get a bit frustrated with the error messages that are thrown in the console:

2009-11-14 14:31:57.513 FC[915:5b27] *** -[SearchResultParser respondsToSelector:]: message sent to deallocated instance 0x82d28e0

This one is not the worst as it actually tells me that it has to do with a selector and that it originates in SearchResultParser. But often I just get "message sent to deallocated instance 0x897867d6".

Other times it is the stack dump, where it just tells me, what I think is, the memory allocations for objects currently in the stack.

Maybe Im spoiled, but I have been use to a lot more info from the error messages, especially from dynamic languages: like line number where the error occurred, instance names of the objects in question and so on.

I read up on using Instruments and there is of course break points. It can just feel a bit pointless manually going through 20+ deallocations and 300 lines of code to find out what caused a halt, when the answer is right in front of you:"0x82d28e0 caused the crash"!

In a bad way I reminds me of the error messages I got from my micro controller IDE:)

Is there a way to go from the instance address e.g. 0x82d28e0 to the instance name? Is there a way to use the information from the console to narrow down where in the code the halt is caused? Especially the "message sent to deallocated instance" since Im apparently a bit to eager with my memory management:)

Hope someone out there can help me get to understand the console better:) Thanks.

最佳回答

The problem with this error is that at the moment the error occurs the deallocated instance is no longer available so the debugger has no information about it. This kind of error never happens in languages with automatic memory management so you can t really compare them in this regard.

Look at the NSZombieEnabled parameter. If you enable zombies, objects are converted to a zombie when your code wants to deallocate them. These can later give you more information about themselves when your code tries to release them once more.

问题回答

暂无回答




相关问题
Caching System.Console output

We have some methods that output a lot of coloured text to the Console. It s actually a menu that is built by looping through a collection of data. Because we are writing item by item (and one line ...

console app c++

i m new to console apps and would appreciate some pointers... i have created a new console app and (not finished but it should be working), i selected win32 console app and then selected empty ...

Java prints output twice in a very specific circumstance

System.out.print("My string: "); My string: BUILD SUCCESSFUL (total time: 1 second) System.out.print("My string "); My string BUILD SUCCESSFUL (total time: 1 second) System.out.print("My string: ...

Removing pause after reading using readLine in java

I am reading several lines from the console in a java program using the readLine command from the BufferedReader class. However, the program pauses at the end of the last line and does not proceed ...

热门标签