• 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: Joar Wingfors <email@hidden>
  • Date: Sat, 9 Jan 2010 17:26:25 -0800

On 9 jan 2010, at 17.15, Mr. Gecko wrote:

> if (connections==nil) {
> 	connections = [[NSMutableArray new] retain];
> }
>
> It says that if (connections==nil) is leaking 32 bytes which I have no idea how that could be possible. Yes I'm releasing connections after I'm done using it.


From the memory management guide:

	"You take ownership of an object if you create it using a method whose
	 name begins with “alloc” or “new” or contains “copy” (for example, alloc, newObject,
	 or mutableCopy), or if you send it a retain message."

So you've done the equivalent of calling retain twice in the example above. The explicit call to retain is incorrect.

j o a r


_______________________________________________

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>)

  • 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: NSAffineTransform
  • Index(es):
    • Date
    • Thread