• 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: NSObject Foundation tool memory issue?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSObject Foundation tool memory issue?


  • Subject: Re: NSObject Foundation tool memory issue?
  • From: Nick Zitzmann <email@hidden>
  • Date: Thu, 8 Dec 2005 16:21:50 -0700


On Dec 8, 2005, at 4:05 PM, Lee Cullens wrote:

This all begs the question of using [object release] at all with autoreleased objects (I know - my density is showing).

You shouldn't; you should keep all retains and releases balanced.

Should I try to minimize my memory footprint with nested autorelease pools alone and forget about specific object releases?

That depends on how long the object is going to stay in use. I try to avoid autoreleasing objects unless I know the pool is going to be popped soon after I'm done with the object, because autoreleasing objects is expensive compared to simply releasing them.

By the time I get to the third "opResult =" I have two unreferenced objects that would have been memory leaks before the advent of autoreleasePool. Does the autorelease mechanism decrement the retain count when I reuse the reference variable?

You can reuse the reference variable as often as you want. Objects will still be autoreleased if they were previously autoreleased and you lose track of them.

Nick Zitzmann
<http://www.chronosnet.com/>


_______________________________________________
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
References: 
 >NSObject Foundation tool memory issue? (From: Lee Cullens <email@hidden>)
 >Re: NSObject Foundation tool memory issue? (From: Niko Matsakis <email@hidden>)
 >Re: NSObject Foundation tool memory issue? (From: Lee Cullens <email@hidden>)
 >Re: NSObject Foundation tool memory issue? (From: Niko Matsakis <email@hidden>)
 >Re: NSObject Foundation tool memory issue? (From: Nick Zitzmann <email@hidden>)
 >Re: NSObject Foundation tool memory issue? (From: Lee Cullens <email@hidden>)

  • Prev by Date: Re: NSObject Foundation tool memory issue?
  • Next by Date: Re: NSObject Foundation tool memory issue?
  • Previous by thread: Re: NSObject Foundation tool memory issue?
  • Next by thread: Re: NSObject Foundation tool memory issue?
  • Index(es):
    • Date
    • Thread