Re: Autorelease Question
Re: Autorelease Question
- Subject: Re: Autorelease Question
- From: Filip van der Meeren <email@hidden>
- Date: Fri, 21 Nov 2008 17:24:36 +0100
Ok, you got me there...
But in my own defense it could still be to make sure that people are
still able te retain the object without creating an overflow... ;-)
Filip van der Meeren
http://www.sourceforge.net/projects/xlinterpreter
On 21 Nov 2008, at 17:19, Jean-Daniel Dupas wrote:
Le 21 nov. 08 à 16:56, Filip van der Meeren a écrit :
Ok, lets say that [NSString string] creates a new object each and
every time a framework/Application needs an empty string (like
about a billion times). Then the RAM would be stuffed with empty
string objects that are useless for everyone.
Now they have created a fix for this, one size fits all. They did
this in a special way, by fixing there retainCount in a special
subclass of NSString:
retainCount
Returns the receiver’s reference count.
- (NSUInteger)retainCount
Return Value
The receiver’s reference count.
Discussion
You rarely send a retainCount message; however, you might implement
this method in a class to implement your own reference-counting
scheme. For objects that never get released (that is, their release
method does nothing), this method should returnUINT_MAX, as defined
in <limits.h>.
The retainCount method does not account for any pending autorelease
messages sent to the receiver.
This method is typically of limited value in debugging memory
management issues.
I quote: "For objects that never get released, this method should
return UINT_MAX". So where do you see your bug ?
Just here in your quote. UINT_MAX is a bug IMHO. It should be
NSUIntegerMax as defined in <Foundation/NSObjCRuntime.h>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden