Re: Best way to debug (was retain/release/pointers question)
Re: Best way to debug (was retain/release/pointers question)
- Subject: Re: Best way to debug (was retain/release/pointers question)
- From: Keith Blount <email@hidden>
- Date: Sat, 4 Dec 2004 11:16:55 -0800 (PST)
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
Many thanks for your reply, much appreciated.
I am now utterly confused, as I am getting several
exceptions at runtime and have no idea what is causing
them. They only occur on rare occasions, and even
then, if I go back and do exactly the same thing to
try and reproduce them, they only seem to occur about
1 in every 10 attempts. They are usually of the
"selector not recognised" variety, but at other times
complain about a string being out of range in my text
view when nothing should have happened. Very strange.
I am therefore wondering what the best way of
debugging is - a very basic question, I know, but none
of the books I have seem to cover this in any depth
(Kochan covers it a little, Hillegass not at all,
barely anything in Anguish et al). Until now, I have
been relying on simple NSLog()s for all my debugging,
but I think I need something more thorough at this
stage - ie. I need to learn how to use the debugger
properly. I have searched the archives and as a result
gone to the Debug menu and added a breakpoint at
[NSException Raise], which stops my program when I get
an exception and provides me with lots of feedback -
but I don't know what to do with that feedback as it
is all either gobbledygook or lists of points in my
code, so that I don't know if one of those is the
problem, or all of them, or none of them.
Is there a good tutorial anywhere on how to understand
all the information in the debugger, or on how to use
the debugger to trace problems? (Eg. what is a
"backtrace"?) I've been looking through stuff about
the debugger in the docs but am still nonplussed.
Many thanks to anyone who can point me in the right
direction, and many apologies for what is probably to
most of you Cocoa experts a very remedial question.
Thank you,
Keith
--- Fabian Lidman <email@hidden> wrote:
> > SomeCusomView *aView = [[SomeCustomView alloc]
> > initWithFrame:aRect];
> > [anotherView addSubview:aView];
> > [aView release];
> >
> > //...
> >
> > [aView doThisOrThat];
>
> Your assumptions are correct. Calling [anObject
> release] the object
> only actually releases when the retain count is 0.
> It is not moved in
> memory.
> The fact that the runtime complains about a selector
> not recognized
> indicates that the object still 'lives' (otherwise
> you'd probably get a
> SIGBUS or something).
> For debugging purposes, use NSLog(@"%d", [anObject
> retainCount]); to
> find out the current retain count of your object.
> Clever use of autorelease and nested autorelease
> pools can save you
> some headache. Read Apple's documentation.
>
>
__________________________________
Do you Yahoo!?
Yahoo! Mail - 250MB free storage. Do more. Manage less.
http://info.mail.yahoo.com/mail_250
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden