Re: Xcode Debugger caused log message...
Re: Xcode Debugger caused log message...
- Subject: Re: Xcode Debugger caused log message...
- From: Chris Espinosa <email@hidden>
- Date: Fri, 1 Jan 2010 09:57:54 -0800
On Jan 1, 2010, at 9:11 AM, Phil Hystad wrote: But, I get the following log message on the console when debugging an Objective-C program (note, not cocoa, this is a data processing program, not U/I). The message:
2010-01-01 09:03:36.969 FileRead[6676:90b] Did you forget to nest alloc and init?
And, it is repeated several times usually. This message NEVER appears when I am running outside of the debugger. Nor, does it appear if I am running in the debugger but merely execute continue with no breakpoints -- thus, no pausing.
One important fact I think is that I am using garbage collection and I have started a separate garbage collection thread.
It appears to be a conflict of sorts between the asynch behavior of the garbage collection thread and my main line of code (my program is otherwise single threaded).
Is this normal behavior while debugging GC programs or am I not doing something correctly. None of my own objects appear to be improperly constructed (nesting alloc and init) -- indeed, I very rarely use alloc and init because I am using other construction messages.
Comments, Answers?
Xcode is trying to display the value of an object (a local or ivar) that you have called +alloc on but not yet -init ed. Xcode's data formatters call the object's -description method, but since the object has not yet been initialized, there is no description.
The best practice is to use the [[classname alloc] init] pattern to ensure that objects are fully initialized before anybody tries to inspect them. If you're doing this in separate steps deliberately, or stepping into the +alloc and trying to look at the results, then you can simply ignore this transient warning.
Chris |
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden