On 14 Jul '08, at 4:12 PM, Shawn Erickson wrote:

It looks like you override release in your "Worker" object (based on
the back trace you posted). Are you thinking -[Worker release] is the
place to free resources? If so it isn't the right place. You want
-[Worker dealloc].

Right. -release just decrements the refcount; it's the counterpart to - retain.

I'm uncomfortable with the idea of overriding retain/release/ retainCount. I know that some Apple docs suggest doing so for singleton objects, but I don't think it's necessary. All you really need to do is provide a +sharedInstance method like

+ (Worker*) sharedInstance {
        static Worker *sInstance;
        if( ! sInstance ) sInstance = [[self alloc] init];
        return sInstance;
}

—Jens

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to