7/18/08 7:48 AM, also sprach [EMAIL PROTECTED]:

> In a method I use a (temporary) dictionary "vAttributes" to read an
> object from an instance variable "vColors" (a dictionary, too):
> 
> - (NSString *)descriptionByColorCode:(int)colorCode
> {
> NSMutableDictionary *vAttributes = [[NSMutableDictionary alloc] init];
> 
> vAttributes = [vColors objectForKey:[NSNumber
> numberWithInt:colorCode]];
> return [vAttributes objectForKey:@"colorDescription"];
> }
> 
> It is my understanding, that after the "alloc" message "vAttributes"'
> retain count is 1 and as I use it in the return statement, a "release"
> out of question. So "vAttributes" should receive an "autorelease"
> message before the return statement to avoid an object leak, but than
> the application crashes after the first invokation of this method.

There is no reason you will crash just because of using autorelease. This
clue, however, may indicate that you are trying to access an object that has
been released due to the normal handling of the autorelease pool. You will
need to learn how to use the Xcode debugger to figure out your problem.

HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


_______________________________________________

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