Re: Release understanding help
Re: Release understanding help
- Subject: Re: Release understanding help
- From: mark <email@hidden>
- Date: Mon, 06 Dec 2004 18:32:53 -0800
I thought maybe that was the problem, thanks!
And thanks for the one (big line!) solution!
Mark
> the problem line is here:
>
> validChars = [validChars stringByAppendingString:[[NSUserDefaults
> standardUserDefaults] objectForKey:NSDecimalSeparator]];
>
> you are reassigning a new NSString that is autoreleased by the
> stringByAppendingString method and are leaking memory of the original
> string. You could initialize validChars like the following to fix it:
>
> NSString * validChars = [[NSString alloc] initWithFormat :
> @"%@%@",@"0123456789mc/'\" ",[[NSUserDefaults standardUserDefaults]
> objectForKey:NSDecimalSeparator]];
> //and remove the following line :
> //validChars = [validChars stringByAppendingString:[[NSUserDefaults
> standardUserDefaults] objectForKey:NSDecimalSeparator]];
>
> The same applies for disallowedCharacters. It's an autoreleased object
> already so releasing it isn't safe. The same also applies for any
> "static"/ class methods. You only release an object you have allocated
> or retained .
>
>
>
> not sure what the "#if 0 ", is for but it doesn't look very safe. I
> would remove it :)
I have now that it works :)
_______________________________________________
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