• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: if statement causing 32 Byte leak?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: if statement causing 32 Byte leak?


  • Subject: Re: if statement causing 32 Byte leak?
  • From: "Mr. Gecko" <email@hidden>
  • Date: Sat, 9 Jan 2010 21:04:21 -0600

Ok, thanks for the help, now I'm going to have to fix all my applications to work like that ;)

On Jan 9, 2010, at 8:34 PM, Graham Cox wrote:

>
> On 10/01/2010, at 1:27 PM, Mr. Gecko wrote:
>
>> So I do not own the object when I get it from string, but I do when I get it from new and that means that I have to release it.
>> So according to that, this code shouldn't leak, right?
>> NSMutableString *string = [NSMutableString string];
>> if (http) {
>> 	[string appendString:@"http://";];
>> } else {
>> 	[string appendString:@"https://";];
>> }
>> [string appendString:@"example.com/"];
>> return [NSURL URLWithString:string];
>>
>> Just seeing if I understand that, it is kinda a lot to remember.
>>
>
>
> Correct - you do not own any object here.
>
> 'string' does not contain 'new', 'alloc' or 'copy' therefore you do not own it. That's all there is to it - just those three things to remember.
>
> --Graham
>
>

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

_______________________________________________

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

References: 
 >if statement causing 32 Byte leak? (From: "Mr. Gecko" <email@hidden>)
 >Re: if statement causing 32 Byte leak? (From: Paul Bruneau <email@hidden>)
 >Re: if statement causing 32 Byte leak? (From: "Mr. Gecko" <email@hidden>)
 >Re: if statement causing 32 Byte leak? (From: Graham Cox <email@hidden>)
 >Re: if statement causing 32 Byte leak? (From: "Mr. Gecko" <email@hidden>)
 >Re: if statement causing 32 Byte leak? (From: Andy Lee <email@hidden>)
 >Re: if statement causing 32 Byte leak? (From: "Mr. Gecko" <email@hidden>)
 >Re: if statement causing 32 Byte leak? (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: if statement causing 32 Byte leak?
  • Next by Date: Re: if statement causing 32 Byte leak?
  • Previous by thread: Re: if statement causing 32 Byte leak?
  • Next by thread: Re: if statement causing 32 Byte leak?
  • Index(es):
    • Date
    • Thread