• 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: In-loop releasing of objects does not free memory?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: In-loop releasing of objects does not free memory?


  • Subject: Re: In-loop releasing of objects does not free memory?
  • From: glenn andreas <email@hidden>
  • Date: Fri, 15 Feb 2008 09:28:39 -0600


On Feb 15, 2008, at 7:41 AM, Jim Correia wrote:

On Feb 14, 2008, at 11:36 PM, j o a r wrote:

On Feb 14, 2008, at 7:57 PM, Jim Correia wrote:

But -release is a no-op in GC code. NSAutoreleasePool will never get the message. So we need a new message that we can send NSAutoreleasePool that it will actually get when running in GC mode. And for convenience, in non-GC mode it should do the same thing as -release always did, to provide a single, simple idiom for inner autorelease pools that will work in either GC or non-GC mode.

Yes, strictly speaking, it is inconsistent. But also necessary; the alternatives would be uglier.

I don't know if I agree. Rather than repeatedly creating and destroying a local autorelease pool in a non-GC app, why not instead using "-drain" with the same type of semantics as in GC?

Well, I was trying to provide a plausible explanation for why we ended up with -drain as a synonym for -release, not second guess the decision with the advantage of hindsight (and the disadvantage of not having all the facts before me.).


I remember the WWDC that was just after "drain" appeared in the headers, there was a comment to the effect that "yeah, we're going to work on GC, and that's what 'drain' is going to be used for, but in the mean time, don't use it because it really doesn't work like you'd expect it to".

My memory colored this as "drain was not suppose to be synonymous with release, but that's how it ended up - sorry". This, of course, neither confirms nor conflicts with the explanation ("release is a nop so we needed a special pseudo-release"), though the "Special Considerations" section of the documentation for -drain is consistent with that.

And lets face it - creating and destroying an auto-release pool isn't that much more work/code/processor time than using a -drain call that works like you'd expect it to on non-GC...

Perhaps filing a bug requesting a "-removeAllObjects" method be added to NSAutoreleasePool which is -drain under GC and is not -release under non-GC?


Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
quadrium | prime : build, mutate, evolve, animate : the next generation of fractal art




_______________________________________________

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: 
 >In-loop releasing of objects does not free memory? (From: Arthur C. <email@hidden>)
 >Re: In-loop releasing of objects does not free memory? (From: John Terranova <email@hidden>)
 >Re: In-loop releasing of objects does not free memory? (From: John Stiles <email@hidden>)
 >RE: In-loop releasing of objects does not free memory? (From: Arthur C. <email@hidden>)
 >Re: In-loop releasing of objects does not free memory? (From: Randall Meadows <email@hidden>)
 >Re: In-loop releasing of objects does not free memory? (From: Uli Kusterer <email@hidden>)
 >Re: In-loop releasing of objects does not free memory? (From: Nick Zitzmann <email@hidden>)
 >Re: In-loop releasing of objects does not free memory? (From: Randall Meadows <email@hidden>)
 >Re: In-loop releasing of objects does not free memory? (From: Michael Watson <email@hidden>)
 >Re: In-loop releasing of objects does not free memory? (From: Keith Duncan <email@hidden>)
 >Re: In-loop releasing of objects does not free memory? (From: Jim Correia <email@hidden>)
 >Re: In-loop releasing of objects does not free memory? (From: j o a r <email@hidden>)
 >Re: In-loop releasing of objects does not free memory? (From: Jim Correia <email@hidden>)

  • Prev by Date: Re: KVC and KVO for arrays
  • Next by Date: Re: logging object creations and destructions
  • Previous by thread: Re: In-loop releasing of objects does not free memory?
  • Next by thread: Re: In-loop releasing of objects does not free memory?
  • Index(es):
    • Date
    • Thread