• 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: static objects "autoreleased with no pool in place - just leaking"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: static objects "autoreleased with no pool in place - just leaking"


  • Subject: Re: static objects "autoreleased with no pool in place - just leaking"
  • From: Pete Yandell <email@hidden>
  • Date: Fri, 13 Feb 2004 23:39:55 +1100

Colours are an interesting case. For most types I'd suggest that:

static NSWhatever* myObject = [[NSWhatever alloc] init];

would work just fine and would avoid the warnings because you're not attempting to add the object to an autorelease pool.

But NSColor doesn't have init methods, only class methods that return autoreleased objects, so you're stuck.

You could always try to be sneaky and do a:

static NSAutoReleasePool* myPool = [[NSAutoReleasePool alloc] init];

before the rest of your static variables, but this would be a severe hack even if it works. I don't think C officially guarantees the initialisation order of static variables.

I'd say that you're probably better off with the more object-oriented approach suggested by other people even if it is more cumbersome.

Pete Yandell
http://pete.yandell.com/
_______________________________________________
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.

  • Follow-Ups:
    • Re: static objects "autoreleased with no pool in place - just leaking"
      • From: j o a r <email@hidden>
References: 
 >static objects "autoreleased with no pool in place - just leaking" (From: m <email@hidden>)
 >Re: static objects "autoreleased with no pool in place - just leaking" (From: j o a r <email@hidden>)
 >Re: static objects "autoreleased with no pool in place - just leaking" (From: m <email@hidden>)
 >Re: static objects "autoreleased with no pool in place - just leaking" (From: j o a r <email@hidden>)
 >Re: static objects "autoreleased with no pool in place - just leaking" (From: m <email@hidden>)
 >Re: static objects "autoreleased with no pool in place - just leaking" (From: j o a r <email@hidden>)
 >Re: static objects "autoreleased with no pool in place - just leaking" (From: m <email@hidden>)
 >Re: static objects "autoreleased with no pool in place - just leaking" (From: j o a r <email@hidden>)
 >Re: static objects "autoreleased with no pool in place - just leaking" (From: m <email@hidden>)

  • Prev by Date: Re: static objects "autoreleased with no pool in place - just leaking"
  • Next by Date: Re: DictionaryWithContentsOfURL
  • Previous by thread: Re: static objects "autoreleased with no pool in place - just leaking"
  • Next by thread: Re: static objects "autoreleased with no pool in place - just leaking"
  • Index(es):
    • Date
    • Thread