Re: Which class methods return autoreleased objects?
Re: Which class methods return autoreleased objects?
- Subject: Re: Which class methods return autoreleased objects?
- From: Charlton Wilbur <email@hidden>
- Date: Mon, 6 Dec 2004 23:43:32 -0500
On Dec 6, 2004, at 11:00 PM, M. Uli Kusterer wrote:
Actually, it *can* be larger than the current function/method, but
you shouldn't rely on it. The default autorelease pool, for example,
is created after the first user action (e.g. after the user chooses a
menu item) and is released when your code returns control to Cocoa
(and thus to the user).
This also masked an error in some code I wrote recently: it was a
complicated Model class, so I wrote it and then wrote a test suite as a
Cocoa shell tool. The problem was, there was a bug in an accessor
function that didn't retain the object passed in -- but because the
autorelease pool persisted throughout the program, and the object that
was passed in had been autoreleased, the bug didn't show up. And
because the Model class passed the test suite, it was the *last* place
I was prepared to look for bugs....
Charlton
--
Charlton Wilbur
email@hidden
email@hidden
_______________________________________________
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