• 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: AutoreleasePools
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AutoreleasePools


  • Subject: Re: AutoreleasePools
  • From: Ondra Cada <email@hidden>
  • Date: Thu, 4 Jul 2002 14:56:00 +0200

I've taken liberty to remove the "threads" part, since this has nothing to do with them actually.

On Thursday, July 4, 2002, at 06:04 , Kevin Perry wrote:

...there's a while() loop that repeats indefinitely that creates a lot of autoreleased objects that will never get released because the pool is released after the while() loop. I've got a half-decent solution to create another autorelease pool at the begin of the while loop and to release it at the end of the loop. However, I don't believe this frequent allocing and releasing of objects is as efficient as it could be. Is there a better solution for this that I have failed to notice?

The generic pattern is something like this:

id pool=[NSAutoreleasePool new];
while (....) {
if (something, like N-th loop, or M seconds from last creation, or whatever) {
[pool release];
pool=[NSAutoreleasePool new];
}
...
}
[pool release];
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: 
 >AutoreleasePools and Threads (From: Kevin Perry <email@hidden>)

  • Prev by Date: Re: array object creation philosophy
  • Next by Date: Re: MOKit
  • Previous by thread: Re: AutoreleasePools and Threads
  • Next by thread: Re: AutoreleasePools and Threads
  • Index(es):
    • Date
    • Thread